/// <summary>Advance to non excluded doc.
/// <br/>On entry:
/// <ul>
/// <li>reqScorer != null, </li>
/// <li>exclScorer != null, </li>
/// <li>reqScorer was advanced once via next() or skipTo()
/// and reqScorer.doc() may still be excluded.</li>
/// </ul>
/// Advances reqScorer a non excluded required doc, if any.
/// </summary>
/// <returns> true iff there is a non excluded required doc.
/// </returns>
private int ToNonExcluded()
{
int exclDoc = exclDisi.DocID();
int reqDoc = reqScorer.DocID(); // may be excluded
do
{
if (reqDoc < exclDoc)
{
return(reqDoc); // reqScorer advanced to before exclScorer, ie. not excluded
}
else if (reqDoc > exclDoc)
{
exclDoc = exclDisi.Advance(reqDoc);
if (exclDoc == NO_MORE_DOCS)
{
exclDisi = null; // exhausted, no more exclusions
return(reqDoc);
}
if (exclDoc > reqDoc)
{
return(reqDoc); // not excluded
}
}
}while ((reqDoc = reqScorer.NextDoc()) != NO_MORE_DOCS);
reqScorer = null; // exhausted, nothing left
return(NO_MORE_DOCS);
}