Andre Rubin wrote:
Hi all,
Most of our queries are very simple, of the type:
Query query = new PrefixQuery(new Term(LABEL_FIELD, prefix));
Hits hits = searcher.search(query, new Sort(new SortField(LABEL_FIELD)))
You might want to check out solrs ConstantScorePrefixQuery and compare
performance.
Which sometimes result in 10, 20, sometimes 40 thousand hits.
I get good performance if hits.length is 20.000 or less (less than 0.5
seconds). I However, if it is 40.000 or more, querying takes over a second,
up to 2.5 seconds. Point in check here is that this solution is not scaling.
Any ideas I can try?
I already exhausted the ideas from http://wiki.apache.org/lucene
-java/ImproveSearchingSpeed
I was reading about TopDocs and TopFieldDocs. Is this search method (using
TopDocs) preferred over Hits? Also, there's no constructor for them without
a Filter, can I just pass null?
It is preferred over Hits. Hits has been deprecated and you should
really migrate away from it.
Is it possible to pre-sort the index, so I don't have to every time I
perform a query?
Any other ideas?
I think in general, sorting and prefix query can be slower operations in
Lucene (though sorting is generally pretty fast after the field caches
are loaded). You might try the first couple suggestions there though,
and others may fill on other steps you can take as well.
- Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]