Hi András, It feels useful to me too, I think we should document this behaviour. For the record, this other issue has just be open and mentions this problem https://issues.apache.org/jira/browse/LUCENE-6326.
On Mon, Mar 2, 2015 at 1:17 PM, András Péteri <apet...@b2international.com> wrote: > Hi, > > According to IndexSearcher's code [1], if a Collector implementation is not > interested in collecting document hits from a particular leaf reader, it > can also throw CollectionTerminatedException from > Collector.getLeafCollector(LeafReaderContext). This option is however not > described in Collector's javadoc [2], only for LeafCollector.collect(int) > [3]. > > Is this considered an implementation detail, or a behavior that will likely > not go away in the future? It seems convenient to throw the exception > straight from getLeafCollector(...) if it is already known that no > information will be collected from a segment, instead of setting a flag on > the returned LeafCollector instance, or adding the test directly to > LeafCollector.collect(int). > > [1] > https://github.com/apache/lucene-solr/blob/lucene_solr_5_0_0/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java#L584 > [2] > https://github.com/apache/lucene-solr/blob/lucene_solr_5_0_0/lucene/core/src/java/org/apache/lucene/search/Collector.java > [3] > https://github.com/apache/lucene-solr/blob/lucene_solr_5_0_0/lucene/core/src/java/org/apache/lucene/search/LeafCollector.java#L84 > > Thanks, > András -- Adrien --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org