Search document by id very slow

混江龙づ霸主 提交于 2019-12-24 11:42:12

问题


my documents has an id field, called "doc_id", declared with the following attributes:

<field name="doc_id" type="long" indexed="true" stored="true" required="true" />

This id is marked as an unique key with the tag.

I try to load many documents at once, giving their ids in request f.e. doc_id:(235, 163, 256, ..., 10473)

The count of identifiers in the query is never greater than 100. However, the more documents are there in the storage the longer it takes for this query to execute. I thought this would be something like the SQL query f.e. "select doc where doc_id in (...)" but with index on "doc_id" the execution time should be constant, shouldn't it? So why is it slowing down in solandra after I add more and more docs?

I'm working with Solandra (Solr 3.4 + Cassandra 1.0.3)

Regards, T


回答1:


Use RealTimeGet (Solr >= 4.0).

http://localhost:8983/solr/get?ids=1,2



回答2:


As the ids are unique do not search over it. The search performance will always be slower.
Try to use filter queries e.g. fq=doc_id:235
This would allow Solr to use filtercache and giving you a much improved performance.



来源:https://stackoverflow.com/questions/8472948/search-document-by-id-very-slow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!