Class AbstractDocumentCollector<T>

  • Type Parameters:
    T - the generic type of the object accepted by the consumer. This could be a key-value map of the fields or a ScannedDocument instance
    Direct Known Subclasses:
    FieldValuesCollector, ScoredDocumentCollector

    public abstract class AbstractDocumentCollector<T>
    extends org.apache.lucene.search.Collector
    An abstract Collector that exposes a Consumer which in turn accepts an object of a generic type
    Since:
    7.17
    • Field Detail

      • requestedFields

        protected final Set<String> requestedFields
    • Constructor Detail

      • AbstractDocumentCollector

        public AbstractDocumentCollector​(org.apache.lucene.search.IndexSearcher indexSearcher,
                                         Set<String> requestedFields,
                                         Consumer<T> consumer)
    • Method Detail

      • setNextReader

        public void setNextReader​(org.apache.lucene.index.AtomicReaderContext readerContext)
        Specified by:
        setNextReader in class org.apache.lucene.search.Collector
      • acceptsDocsOutOfOrder

        public boolean acceptsDocsOutOfOrder()
        Specified by:
        acceptsDocsOutOfOrder in class org.apache.lucene.search.Collector
      • collect

        public void collect​(int docID)
                     throws IOException
        Specified by:
        collect in class org.apache.lucene.search.Collector
        Throws:
        IOException
      • toConsumable

        public abstract T toConsumable​(org.apache.lucene.document.Document document)
      • getCount

        public long getCount()
      • setIndexSearcher

        public void setIndexSearcher​(org.apache.lucene.search.IndexSearcher indexSearcher)
      • getRequestedFields

        protected Map<String,​String[]> getRequestedFields​(org.apache.lucene.document.Document document)