Class MatchRegionRetriever


  • public class MatchRegionRetriever
    extends java.lang.Object
    Utility class to compute a list of "match regions" for a given query, searcher and document(s) using Matches API.
    • Field Detail

      • weight

        private final Weight weight
      • affectedFields

        private final java.util.TreeSet<java.lang.String> affectedFields
      • preloadFields

        private final java.util.Set<java.lang.String> preloadFields
    • Constructor Detail

      • MatchRegionRetriever

        public MatchRegionRetriever​(IndexSearcher searcher,
                                    Query query,
                                    Analyzer analyzer)
                             throws java.io.IOException
        A constructor with the default offset strategy supplier.
        Parameters:
        analyzer - An analyzer that may be used to reprocess (retokenize) document fields in the absence of position offsets in the index. Note that the analyzer must return tokens (positions and offsets) identical to the ones stored in the index.
        Throws:
        java.io.IOException
      • MatchRegionRetriever

        public MatchRegionRetriever​(IndexSearcher searcher,
                                    Query query,
                                    OffsetsRetrievalStrategySupplier fieldOffsetStrategySupplier)
                             throws java.io.IOException
        Parameters:
        searcher - Index searcher to be used for retrieving matches.
        query - The query for which matches should be retrieved. The query should be rewritten against the provided searcher.
        fieldOffsetStrategySupplier - A custom supplier of per-field OffsetsRetrievalStrategy instances.
        Throws:
        java.io.IOException
    • Method Detail

      • highlightDocuments

        public void highlightDocuments​(java.util.PrimitiveIterator.OfInt docIds,
                                       MatchRegionRetriever.MatchOffsetsConsumer consumer)
                                throws java.io.IOException
        Low-level, high-efficiency method for highlighting large numbers of documents at once in a streaming fashion.
        Parameters:
        docIds - A stream of sorted document identifiers for which hit ranges should be returned.
        consumer - A streaming consumer for document-hits pairs.
        Throws:
        java.io.IOException
      • checkOrderConsistency

        private boolean checkOrderConsistency​(java.util.List<LeafReaderContext> leaves)