コード例 #1
0
        public bool nextDoc()
        {
            if (freq.Eof())
            {
                if (p.lastDocCode != -1)
                {
                    // Return last doc
                    docID = p.lastDocID;
                    if (!field.omitTf)
                    {
                        termFreq = p.docFreq;
                    }
                    p.lastDocCode = -1;
                    return(true);
                }
                else
                {
                    // EOF
                    return(false);
                }
            }

            int code = freq.ReadVInt();

            if (field.omitTf)
            {
                docID += code;
            }
            else
            {
                docID += (int)((uint)code >> 1);
                if ((code & 1) != 0)
                {
                    termFreq = 1;
                }
                else
                {
                    termFreq = freq.ReadVInt();
                }
            }

            System.Diagnostics.Debug.Assert(docID != p.lastDocID);

            return(true);
        }
コード例 #2
0
        public bool NextDoc()
        {
            if (freq.Eof())
            {
                if (p.lastDocCode != -1)
                {
                    // Return last doc
                    docID = p.lastDocID;
                    if (!field.omitTermFreqAndPositions)
                    {
                        termFreq = p.docFreq;
                    }
                    p.lastDocCode = -1;
                    return(true);
                }
                // EOF
                else
                {
                    return(false);
                }
            }

            int code = freq.ReadVInt();

            if (field.omitTermFreqAndPositions)
            {
                docID += code;
            }
            else
            {
                docID += SupportClass.Number.URShift(code, 1);
                if ((code & 1) != 0)
                {
                    termFreq = 1;
                }
                else
                {
                    termFreq = freq.ReadVInt();
                }
            }

            System.Diagnostics.Debug.Assert(docID != p.lastDocID);

            return(true);
        }