Beispiel #1
0
        /// <summary>
        /// Adds a new doc in this term.  If this returns null
        ///  then we just skip consuming positions/payloads.
        /// </summary>
        public override void StartDoc(int docID, int termDocFreq)
        {
            int delta = docID - lastDocID;

            //System.out.println("SEPW: startDoc: write doc=" + docID + " delta=" + delta + " out.fp=" + docOut);

            if (docID < 0 || (df > 0 && delta <= 0))
            {
                throw new CorruptIndexException("docs out of order (" + docID + " <= " + lastDocID + " ) (docOut: " + docOut + ")");
            }

            if ((++df % skipInterval) == 0)
            {
                // TODO: -- awkward we have to make these two
                // separate calls to skipper
                //System.out.println("    buffer skip lastDocID=" + lastDocID);
                skipListWriter.SetSkipData(lastDocID, storePayloads, lastPayloadLength);
                skipListWriter.BufferSkip(df);
            }

            lastDocID = docID;
            docOut.Write(delta);
            if (indexOptions != IndexOptions.DOCS_ONLY)
            {
                //System.out.println("    sepw startDoc: write freq=" + termDocFreq);
                freqOut.Write(termDocFreq);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Adds a new doc in this term.  If this returns null
        ///  then we just skip consuming positions/payloads.
        /// </summary>
        public override void StartDoc(int docId, int termDocFreq)
        {
            var delta = docId - LAST_DOC_ID;

            if (docId < 0 || (DF > 0 && delta <= 0))
            {
                throw new CorruptIndexException("docs out of order (" + docId + " <= " + LAST_DOC_ID + " ) (docOut: " +
                                                DOC_OUT + ")");
            }

            if ((++DF % SKIP_INTERVAL) == 0)
            {
                // TODO: -- awkward we have to make these two separate calls to skipper
                SKIP_LIST_WRITER.SetSkipData(LAST_DOC_ID, STORE_PAYLOADS, LAST_PAYLOAD_LENGTH);
                SKIP_LIST_WRITER.BufferSkip(DF);
            }

            LAST_DOC_ID = docId;
            DOC_OUT.Write(delta);
            if (INDEX_OPTIONS != FieldInfo.IndexOptions.DOCS_ONLY)
            {
                //System.out.println("    sepw startDoc: write freq=" + termDocFreq);
                FREQ_OUT.Write(termDocFreq);
            }
        }