// 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 }
public override bool SkipTo(int target) { for (PhrasePositions pp = first; more && pp != null; pp = pp.next) { more = pp.SkipTo(target); } if (more) { Sort(); // re-sort } return(DoNext()); }