예제 #1
0
 /// <summary> Advances to the first match beyond the current whose document number is
 /// greater than or equal to a given target. <br/>
 /// The implementation uses the skipTo() method on the subscorers.
 ///
 /// </summary>
 /// <param name="target">The target document number.
 /// </param>
 /// <returns> the document whose number is greater than or equal to the given
 /// target, or -1 if none exist.
 /// </returns>
 public override int Advance(int target, IState state)
 {
     if (scorerDocQueue.Size() < minimumNrMatchers)
     {
         return(currentDoc = NO_MORE_DOCS);
     }
     if (target <= currentDoc)
     {
         return(currentDoc);
     }
     do
     {
         if (scorerDocQueue.TopDoc() >= target)
         {
             return(AdvanceAfterCurrent(state)?currentDoc:(currentDoc = NO_MORE_DOCS));
         }
         else if (!scorerDocQueue.TopSkipToAndAdjustElsePop(target, state))
         {
             if (scorerDocQueue.Size() < minimumNrMatchers)
             {
                 return(currentDoc = NO_MORE_DOCS);
             }
         }
     }while (true);
 }
 /// <summary>Skips to the first match beyond the current whose document number is
 /// greater than or equal to a given target.
 /// <br>When this method is used the {@link #Explain(int)} method should not be used.
 /// <br>The implementation uses the skipTo() method on the subscorers.
 /// </summary>
 /// <param name="target">The target document number.
 /// </param>
 /// <returns> true iff there is such a match.
 /// </returns>
 public override bool SkipTo(int target)
 {
     if (scorerDocQueue == null)
     {
         InitScorerDocQueue();
     }
     if (queueSize < minimumNrMatchers)
     {
         return(false);
     }
     if (target <= currentDoc)
     {
         return(true);
     }
     do
     {
         if (scorerDocQueue.TopDoc() >= target)
         {
             return(AdvanceAfterCurrent());
         }
         else if (!scorerDocQueue.TopSkipToAndAdjustElsePop(target))
         {
             if (--queueSize < minimumNrMatchers)
             {
                 return(false);
             }
         }
     }while (true);
 }