Byter
Byter

Reputation: 1132

Getting ALL Results of a Lucene Query

I Using 3.5.0 version of Lucene.

I am searching like this.

final TopDocs docs = searcher.search(finalQuery, resultSize);

But I Dont want to specify the resultsize ; instead i want all the matching results.

One of the method is to give the Total number of records in the index as the resultSize.

Is there an any other method to do this?

Upvotes: 0

Views: 691

Answers (1)

Marko Topolnik
Marko Topolnik

Reputation: 200296

Due to the way things are done internally in Lucene, it is perfectly fine to just use a large enough resultSize. You won't conserve any memory if you do anything else, and the results are returned in a memory-optimized way, with no documents actually loaded.

Upvotes: 4

Related Questions