Esempio n. 1
0
        internal void WriteProx(int termID, int proxCode)
        {
            //System.out.println("writeProx termID=" + termID + " proxCode=" + proxCode);
            Debug.Assert(HasProx);
            BytesRef payload;

            if (PayloadAttribute == null)
            {
                payload = null;
            }
            else
            {
                payload = PayloadAttribute.Payload;
            }

            if (payload != null && payload.Length > 0)
            {
                TermsHashPerField.WriteVInt(1, (proxCode << 1) | 1);
                TermsHashPerField.WriteVInt(1, payload.Length);
                TermsHashPerField.WriteBytes(1, payload.Bytes, payload.Offset, payload.Length);
                HasPayloads = true;
            }
            else
            {
                TermsHashPerField.WriteVInt(1, proxCode << 1);
            }

            FreqProxPostingsArray postings = (FreqProxPostingsArray)TermsHashPerField.PostingsArray;

            postings.LastPositions[termID] = FieldState.Position_Renamed;
        }
        internal void  WriteProx(FreqProxTermsWriter.PostingList p, int proxCode)
        {
            Payload payload;

            if (payloadAttribute == null)
            {
                payload = null;
            }
            else
            {
                payload = payloadAttribute.Payload;
            }

            if (payload != null && payload.internalLength > 0)
            {
                termsHashPerField.WriteVInt(1, (proxCode << 1) | 1);
                termsHashPerField.WriteVInt(1, payload.internalLength);
                termsHashPerField.WriteBytes(1, payload.data, payload.internalOffset, payload.internalLength);
                hasPayloads = true;
            }
            else
            {
                termsHashPerField.WriteVInt(1, proxCode << 1);
            }
            p.lastPosition = fieldState.position;
        }
        internal override void  NewTerm(RawPostingList p0)
        {
            System.Diagnostics.Debug.Assert(docState.TestPoint("TermVectorsTermsWriterPerField.newTerm start"));

            TermVectorsTermsWriter.PostingList p = (TermVectorsTermsWriter.PostingList)p0;

            p.freq = 1;

            if (doVectorOffsets)
            {
                int startOffset = fieldState.offset + offsetAttribute.StartOffset();;
                int endOffset   = fieldState.offset + offsetAttribute.EndOffset();

                termsHashPerField.WriteVInt(1, startOffset);
                termsHashPerField.WriteVInt(1, endOffset - startOffset);
                p.lastOffset = endOffset;
            }

            if (doVectorPositions)
            {
                termsHashPerField.WriteVInt(0, fieldState.position);
                p.lastPosition = fieldState.position;
            }
        }