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
コード例 #1
0
ファイル: ReqExclScorer.cs プロジェクト: stgwilli/ravendb
        /// <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);
        }
コード例 #2
0
        public virtual void  AssertContainsDocId(System.String msg, DocIdSet docIdSet, int docId)
        {
            DocIdSetIterator it = docIdSet.Iterator(null);

            Assert.IsTrue(it.Advance(docId, null) != DocIdSetIterator.NO_MORE_DOCS, msg);
            Assert.IsTrue(it.DocID() == docId, msg);
        }
コード例 #3
0
 public override int DocID()
 {
     return(DocIdSetIterator.DocID());
 }
コード例 #4
0
 ///<summary>Adds a DocIdSetIterator to the DisiDocQueue in log(size) time if either
 ///   * the DisiDocQueue is not full, or not lessThan(disi, top()). </summary>
 ///   * <param name="disi"> </param>
 ///   * <returns> true if DocIdSetIterator is added, false otherwise. </returns>
 public bool Insert(DocIdSetIterator disi)
 {
     if (size < maxSize)
     {
         Put(disi);
         return true;
     }
     else
     {
         int docNr = disi.DocID();
         if ((size > 0) && (!(docNr < topHDD.Doc))) // heap[1] is top()
         {
             heap[1] = new HeapedDisiDoc(disi, docNr);
             DownHeap();
             return true;
         }
         else
         {
             return false;
         }
     }
 }
コード例 #5
0
 internal HeapedDisiDoc(DocIdSetIterator disi)
     : this(disi, disi.DocID())
 {
 }