lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jm <>
Subject get the total number of hits of a query
Date Tue, 23 Feb 2010 16:22:46 GMT

I need to find out how many hits a query will get, is this a valid
way? (Lucene 3.0)

        Query lucquery = ...;
        IndexSearcher[] indexes = ...
        MultiSearcher ms = new MultiSearcher(indexes);
        TopDocs tp =, Integer.MAX_VALUE);
        int hits = tp.totalHits;

Then depending on the number of hits I will run it again to get all
results or not.

I have found some posts talking about something similar but I could
not see a clear answer...


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message