예제 #1
0
        // next without initial increment
        private bool DoNext()
        {
            while (more)
            {
                while (more && first.doc < last.doc)
                {
                    // find doc w/ all the terms
                    more = first.SkipTo(last.doc);     // skip first upto last
                    FirstToLast();                     // and move it to the end
                }

                if (more)
                {
                    // found a doc with all of the terms
                    freq = PhraseFreq();                     // check for phrase
                    if (freq == 0.0f)
                    {
                        // no match
                        more = last.Next();
                    }
                    // trigger further scanning
                    else
                    {
                        return(true);                        // found a match
                    }
                }
            }
            return(false);            // no more matches
        }
예제 #2
0
 public override int Advance(int target)
 {
     firstTime = false;
     for (PhrasePositions pp = first; more && pp != null; pp = pp.next)
     {
         more = pp.SkipTo(target);
     }
     if (more)
     {
         Sort();                 // re-sort
     }
     if (!DoNext())
     {
         first.doc = NO_MORE_DOCS;
     }
     return(first.doc);
 }