Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-1652

Enhancements to Scorers following the changes to DocIdSetIterator

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Invalid
    • None
    • 3.0
    • core/search
    • None
    • New

    Description

      In LUCENE-1614, we changed the semantics of DocIdSetIterator's methods to return a sentinel NO_MORE_DOCS (= Integer.MAX_VALUE) when the iterator has exhausted. Due to backward compatibility issues, we couldn't implement that semantics in doc(). Therefore this issue, which can be introduced in 3.0 only will:

      1. Implement the new semantics in all extending classes, such that doc() will return NO_MORE_DOCS when the iterator has exhausted.
      2. Change BooleanScorer to take advantage of that by removing sub.done from SubScorer and operate under the assumption that NO_MORE_DOCS is larger than any doc ID (Integer.MAX_VALUE).
      3. Change ConjunctionScorer to operate under the same assumptions and remove 'more'.
      4. Change ReqExclScorer to not rely on reqScorer in doc(), since the latter may be null.
      5. Make more changes to ConjunctionScorer's init() and remove 'firstTime' to improve the performance of nextDoc(), score(), advance().
      6. Add start()/finish() to DISI?

      A snippet from LUCENE-1614 regarding the change in BooleanScorer

      int doc = sub.done ? -1 : scorer.doc();
      while (!sub.done && doc < end) {
        sub.collector.collect(doc);
        doc = scorer.nextDoc();
        sub.done = doc < 0;
      }
      

      To this:

      int doc = scorer.doc();
      while (doc < end) {
        sub.collector.collect(doc);
        doc = scorer.nextDoc();
      }
      

      And in ConjunctionScorer, change this:

      while (more && (firstScorer=scorers[first]).doc() < (lastDoc=lastScorer.doc())) {
        more = firstScorer.advance(lastDoc) >= 0;
        lastScorer = firstScorer;
        first = (first == (scorers.length-1)) ? 0 : first+1;
      }
      return more;
      

      To this:

      while ((firstScorer=scorers[first]).doc() < (lastDoc=lastScorer.doc())) {
        firstScorer.advance(lastDoc);
        lastScorer = firstScorer;
        first = (first == (scorers.length-1)) ? 0 : first+1;
      }
      return lastDoc != DOC_SENTINEL;
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            shaie Shai Erera
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: