lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <>
Subject Re: Performance, yet again
Date Tue, 02 Sep 2008 17:16:51 GMT
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 =, new Sort(new SortField(LABEL_FIELD)))
You might want to check out solrs ConstantScorePrefixQuery and compare 
> 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
> -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:
For additional commands, e-mail:

View raw message