Hello Is there a way to stop the search process when a given number of hits is reached?
I have a counter feature which displays how many docs match a query. This counter is blocked; I mean that if there are more than 500 docs, it will just display "more than 500". I don't care about the exact amount of docs matched by the query, the order of the hits or whatever... What I want is to stop the search process when it reaches at least 500 hits in order to improve performance... (I want an average search time in about 50 - 100 ms) I experimented with the following methods : For the same query: with search(Query query, Filter filter, Sort sort) hits=157691 docs in searchingTime=2514 ms with search(Query query, Filter filter, int n) (with n = 50) TopDocs totalHits 157691 in searchingTime= 2360 ms For another query: With search(Query query, Filter filter, Sort sort) hits=1208 docs in searchingTime=750 ms With search(Query query, Filter filter, int n) (with n = 50) TopDocs totalHits 1208 in searchingTime= 718 ms For another query: With search(Query query, Filter filter, Sort sort) hits=16174 cv(s) searchingTime=1297 ms With search(Query query, Filter filter, int n) (with n = 50) TopDocs totalHits 16174 in searchingTime= 1219 ms According to this results, replacing the first method by the other has no effect on either the search time or total number of hits returned Also the lucene version used now is 1.9.1 (but i work on the evolution to 2.3.2) Thanks a lot (Sorry for my bad English ... you will easily guess, I’m French ;) _____________________________________________________________________________ Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr