lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr <bfore...@163.com>
Subject Re:How to limit SimpleCollector at N documents?
Date Fri, 18 Aug 2017 05:59:43 GMT
i used to do the same thing. My way is also throwing exception to jump out. What does "then
the search moves on to the next leaf" mean ?
在 2017-08-18 03:46:02,"Tod Olson" <tod@uchicago.edu> 写道:
Hi everyone,

I'm modifying an existing application, which uses a Lucene SimpleCollector to return document
ids and some other fields from a search. For various reasons, we now want to place an upper
bound on the number of documents actually collected.

Is there a reasonable way to put a limit on the results returned by a SimpleCollector? Or
do I need to change Collectors?

Based on the docs, I could keep a counter and raise a CollectionTerminatedException after
N documents, but then the search moves on to the next leaf. I'd like to have the entire search
terminate and return the collected documents.

Any assistance for a Lucene novice is greatly appreciated!

-Tod


Tod Olson <tod@uchicago.edu<mailto:tod@uchicago.edu>>
Systems Librarian
Interim Director for Integrated Library Systems
University of Chicago Library


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Mime
View raw message