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

NextDoc NPE safety when bulk collecting

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 3.6.2
    • None
    • core/index, core/other
    • Any with custom filters

    • New

    Description

      Hello,

      I would like to apply ACL once as a PostFilter and I therefore need to bulk this call since round trips would severely decrease performances.

      I tried to just stack them on the DelegatingCollector using this collect :

      @Override
      public void collect(int doc) throws IOException {
      while ((doc = scorer.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS)

      { docs.put(getDocumentId(doc), doc); }

      batchCollect();
      }

      Depending on the Scorer it may or it may not work. Indeed when the Scorer is "Safe" that is when it handles
      the case in which the scorer is exhausted and is called once again after exhaustion.
      This is the case of the (e.g. DisjunctionMaxScorer, ConstantScorer):

      if (numScorers == 0) return doc = NO_MORE_DOCS;

      On the other hand, when using the DisjunctionSumScorer, it either asserts on "NO_MORE_DOCS", or it throws a NPE.

      Shouldn't we copy the DisjunctionMaxScorer mechanism to protect nextDoc of an exausted iterator using either current doc or checking numbers of subScorers ?

      Attachments

        Activity

          People

            Unassigned Unassigned
            alexistp Alexis Torres Paderewski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: