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

Reply via email to