Lucene.Net.Search.DocIdSetIterator.DocID C# (CSharp) Method

DocID() public abstract method

Returns the following:
  • -1 or #NO_MORE_DOCS if #nextDoc() or #advance(int) were not called yet.
  • #NO_MORE_DOCS if the iterator has exhausted.
  • Otherwise it should return the doc ID it is currently on.

@since 2.9

public abstract DocID ( ) : int
return int
        public abstract int DocID(); // LUCENENET TODO: Change to property getter

Usage Example

Beispiel #1
0
        /// <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);
        }
All Usage Examples Of Lucene.Net.Search.DocIdSetIterator::DocID