2
votes

When searching, is there a way to disable scoring for any query?

The scenario is that the user refines his query by trying different combinations of words, phrases etc., and needs realtime (well, reasonably fast at least) responses on the number of hits.

Search time slows down a lot when there are millions of hits due to scoring, but the user really doesn't care about all these documents. As soon as he sees there are 1M+ hits he will start adding additional words to the query. A "Sort by relevance" option would allow him to do this quickly, while turning scoring back on when the number of hits is reasonable.

Is this possible?

I'm using Lucene.NET 2.9.2 but AFAIK it is identical to the Java version.

2

2 Answers

4
votes

Try ConstantScoreQuery. This only returns the hits, without scoring them.

0
votes

In Lucene 2.9 you can use a custom Collector that can do what you want (get hits without scoring).

http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc/all/org/apache/lucene/search/Collector.html