Class BooleanScorer

    • Constructor Detail

      • BooleanScorer

        BooleanScorer​(BooleanWeight weight,
                      java.util.Collection<BulkScorer> scorers,
                      int minShouldMatch,
                      boolean needsScores)
    • Method Detail

      • cost

        private static long cost​(java.util.Collection<BulkScorer> scorers,
                                 int minShouldMatch)
      • scoreWindowIntoBitSetAndReplay

        private void scoreWindowIntoBitSetAndReplay​(LeafCollector collector,
                                                    Bits acceptDocs,
                                                    int base,
                                                    int min,
                                                    int max,
                                                    BooleanScorer.BulkScorerAndDoc[] scorers,
                                                    int numScorers)
                                             throws java.io.IOException
        Throws:
        java.io.IOException
      • scoreWindowMultipleScorers

        private void scoreWindowMultipleScorers​(LeafCollector collector,
                                                Bits acceptDocs,
                                                int windowBase,
                                                int windowMin,
                                                int windowMax,
                                                int maxFreq)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • scoreWindowSingleScorer

        private void scoreWindowSingleScorer​(BooleanScorer.BulkScorerAndDoc bulkScorer,
                                             LeafCollector collector,
                                             Bits acceptDocs,
                                             int windowMin,
                                             int windowMax,
                                             int max)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • score

        public int score​(LeafCollector collector,
                         Bits acceptDocs,
                         int min,
                         int max)
                  throws java.io.IOException
        Description copied from class: BulkScorer
        Collects matching documents in a range and return an estimation of the next matching document which is on or after max.

        The return value must be:

        min is the minimum document to be considered for matching. All documents strictly before this value must be ignored.

        Although max would be a legal return value for this method, higher values might help callers skip more efficiently over non-matching portions of the docID space.

        For instance, a Scorer-based implementation could look like below:

         private final Scorer scorer; // set via constructor
        
         public int score(LeafCollector collector, Bits acceptDocs, int min, int max) throws IOException {
           collector.setScorer(scorer);
           int doc = scorer.docID();
           if (doc < min) {
             doc = scorer.advance(min);
           }
           while (doc < max) {
             if (acceptDocs == null || acceptDocs.get(doc)) {
               collector.collect(doc);
             }
             doc = scorer.nextDoc();
           }
           return doc;
         }
         
        Specified by:
        score in class BulkScorer
        Parameters:
        collector - The collector to which all matching documents are passed.
        acceptDocs - Bits that represents the allowed documents to match, or null if they are all allowed to match.
        min - Score starting at, including, this document
        max - Score up to, but not including, this doc
        Returns:
        an under-estimation of the next matching doc after max
        Throws:
        java.io.IOException