public override void DecodeTerm(long[] longs, DataInput @in, FieldInfo fieldInfo, BlockTermState termState, bool absolute)
        {
            StandardTermState termState2 = (StandardTermState)termState;
            // if (DEBUG) System.out.println("SPR: nextTerm seg=" + segment + " tbOrd=" + termState2.termBlockOrd + " bytesReader.fp=" + termState.bytesReader.getPosition());
            bool isFirstTerm = termState2.TermBlockOrd == 0;

            if (absolute)
            {
                termState2.freqOffset = 0;
                termState2.proxOffset = 0;
            }

            termState2.freqOffset += @in.ReadVInt64();

            /*
             * if (DEBUG) {
             * System.out.println("  dF=" + termState2.docFreq);
             * System.out.println("  freqFP=" + termState2.freqOffset);
             * }
             */
            if (Debugging.AssertsEnabled)
            {
                Debugging.Assert(termState2.freqOffset < freqIn.Length);
            }

            if (termState2.DocFreq >= skipMinimum)
            {
                termState2.skipOffset = @in.ReadVInt64();
                // if (DEBUG) System.out.println("  skipOffset=" + termState2.skipOffset + " vs freqIn.length=" + freqIn.length());
                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert(termState2.freqOffset + termState2.skipOffset < freqIn.Length);
                }
            }
            else
            {
                // undefined
            }

            if (fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
            {
                termState2.proxOffset += @in.ReadVInt64();
                // if (DEBUG) System.out.println("  proxFP=" + termState2.proxOffset);
            }
        }
Beispiel #2
0
            public virtual SegmentFullPositionsEnum Reset(FieldInfo fieldInfo, StandardTermState termState, IBits liveDocs)
            {
                // LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare()
                storeOffsets  = IndexOptionsComparer.Default.Compare(fieldInfo.IndexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
                storePayloads = fieldInfo.HasPayloads;
                if (Debugging.AssertsEnabled)
                {
                    // LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare()
                    Debugging.Assert(IndexOptionsComparer.Default.Compare(fieldInfo.IndexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0);
                    Debugging.Assert(storePayloads || storeOffsets);
                }
                if (payload == null)
                {
                    payload       = new BytesRef();
                    payload.Bytes = new byte[1];
                }

                this.liveDocs = liveDocs;

                // TODO: for full enum case (eg segment merging) this
                // seek is unnecessary; maybe we can avoid in such
                // cases
                freqIn.Seek(termState.freqOffset);
                lazyProxPointer = termState.proxOffset;

                limit       = termState.DocFreq;
                ord         = 0;
                doc         = -1;
                accum       = 0;
                position    = 0;
                startOffset = 0;

                skipped         = false;
                posPendingCount = 0;
                payloadPending  = false;

                freqOffset = termState.freqOffset;
                proxOffset = termState.proxOffset;
                skipOffset = termState.skipOffset;
                //System.out.println("StandardR.D&PE reset seg=" + segment + " limit=" + limit + " freqFP=" + freqOffset + " proxFP=" + proxOffset + " this=" + this);

                return(this);
            }
Beispiel #3
0
        public override void EncodeTerm(long[] empty, DataOutput @out, FieldInfo fieldInfo, BlockTermState state, bool absolute)
        {
            StandardTermState state_ = (StandardTermState)state;

            if (absolute)
            {
                lastState = emptyState;
            }
            @out.WriteVInt64(state_.FreqStart - lastState.FreqStart);
            if (state_.SkipOffset != -1)
            {
                Debug.Assert(state_.SkipOffset > 0);
                @out.WriteVInt64(state_.SkipOffset);
            }
            if (indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
            {
                @out.WriteVInt64(state_.ProxStart - lastState.ProxStart);
            }
            lastState = state_;
        }
Beispiel #4
0
        public override void EncodeTerm(long[] empty, DataOutput @out, FieldInfo fieldInfo, BlockTermState _state, bool absolute)
        {
            StandardTermState state = (StandardTermState)_state;

            if (absolute)
            {
                LastState = EmptyState;
            }
            @out.WriteVLong(state.FreqStart - LastState.FreqStart);
            if (state.SkipOffset != -1)
            {
                Debug.Assert(state.SkipOffset > 0);
                @out.WriteVLong(state.SkipOffset);
            }
            if (IndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
            {
                @out.WriteVLong(state.ProxStart - LastState.ProxStart);
            }
            LastState = state;
        }
Beispiel #5
0
        // Currently, this instance is re-used across fields, so
        // our parent calls setField whenever the field changes
        public override int SetField(FieldInfo fieldInfo)
        {
            //System.out.println("SPW: setField");

            /*
             * if (BlockTreeTermsWriter.DEBUG && fieldInfo.Name.equals("id")) {
             * DEBUG = true;
             * } else {
             * DEBUG = false;
             * }
             */
            this.FieldInfo = fieldInfo;
            IndexOptions   = fieldInfo.FieldIndexOptions;

            StoreOffsets  = IndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
            StorePayloads = fieldInfo.HasPayloads();
            LastState     = EmptyState;
            //System.out.println("  set init blockFreqStart=" + freqStart);
            //System.out.println("  set init blockProxStart=" + proxStart);
            return(0);
        }
Beispiel #6
0
        // Currently, this instance is re-used across fields, so
        // our parent calls setField whenever the field changes
        public override int SetField(FieldInfo fieldInfo)
        {
            //System.out.println("SPW: setField");

            /*
             * if (BlockTreeTermsWriter.DEBUG && fieldInfo.Name.Equals("id", StringComparison.Ordinal)) {
             * DEBUG = true;
             * } else {
             * DEBUG = false;
             * }
             */
            this.fieldInfo = fieldInfo;
            indexOptions   = fieldInfo.IndexOptions;

            storeOffsets  = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
            storePayloads = fieldInfo.HasPayloads;
            lastState     = emptyState;
            //System.out.println("  set init blockFreqStart=" + freqStart);
            //System.out.println("  set init blockProxStart=" + proxStart);
            return(0);
        }
        public override void DecodeTerm(long[] longs, DataInput @in, FieldInfo fieldInfo, BlockTermState _termState, bool absolute)
        {
            StandardTermState termState = (StandardTermState)_termState;
            // if (DEBUG) System.out.println("SPR: nextTerm seg=" + segment + " tbOrd=" + termState.termBlockOrd + " bytesReader.fp=" + termState.bytesReader.getPosition());
            bool isFirstTerm = termState.TermBlockOrd == 0;

            if (absolute)
            {
                termState.FreqOffset = 0;
                termState.ProxOffset = 0;
            }

            termState.FreqOffset += @in.ReadVLong();

            /*
             * if (DEBUG) {
             * System.out.println("  dF=" + termState.docFreq);
             * System.out.println("  freqFP=" + termState.freqOffset);
             * }
             */
            Debug.Assert(termState.FreqOffset < FreqIn.Length());

            if (termState.DocFreq >= SkipMinimum)
            {
                termState.SkipOffset = @in.ReadVLong();
                // if (DEBUG) System.out.println("  skipOffset=" + termState.skipOffset + " vs freqIn.length=" + freqIn.length());
                Debug.Assert(termState.FreqOffset + termState.SkipOffset < FreqIn.Length());
            }
            else
            {
                // undefined
            }

            if (fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
            {
                termState.ProxOffset += @in.ReadVLong();
                // if (DEBUG) System.out.println("  proxFP=" + termState.proxOffset);
            }
        }
            public virtual SegmentFullPositionsEnum Reset(FieldInfo fieldInfo, StandardTermState termState, Bits liveDocs)
            {
                StoreOffsets  = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
                StorePayloads = fieldInfo.HasPayloads();
                Debug.Assert(fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
                Debug.Assert(StorePayloads || StoreOffsets);
                if (Payload_Renamed == null)
                {
                    Payload_Renamed       = new BytesRef();
                    Payload_Renamed.Bytes = new byte[1];
                }

                this.LiveDocs = liveDocs;

                // TODO: for full enum case (eg segment merging) this
                // seek is unnecessary; maybe we can avoid in such
                // cases
                FreqIn.Seek(termState.FreqOffset);
                LazyProxPointer = termState.ProxOffset;

                Limit               = termState.DocFreq;
                Ord                 = 0;
                Doc                 = -1;
                Accum               = 0;
                Position            = 0;
                StartOffset_Renamed = 0;

                Skipped         = false;
                PosPendingCount = 0;
                PayloadPending  = false;

                FreqOffset = termState.FreqOffset;
                ProxOffset = termState.ProxOffset;
                SkipOffset = termState.SkipOffset;
                //System.out.println("StandardR.D&PE reset seg=" + segment + " limit=" + limit + " freqFP=" + freqOffset + " proxFP=" + proxOffset + " this=" + this);

                return(this);
            }
Beispiel #9
0
        /// <summary>
        /// Called when we are done adding docs to this term </summary>
        public override void FinishTerm(BlockTermState _state)
        {
            StandardTermState state = (StandardTermState)_state;

            // if (DEBUG) System.out.println("SPW: finishTerm seg=" + segment + " freqStart=" + freqStart);
            Debug.Assert(state.DocFreq > 0);

            // TODO: wasteful we are counting this (counting # docs
            // for this term) in two places?
            Debug.Assert(state.DocFreq == Df);
            state.FreqStart = FreqStart;
            state.ProxStart = ProxStart;
            if (Df >= SkipMinimum)
            {
                state.SkipOffset = SkipListWriter.WriteSkip(FreqOut) - FreqStart;
            }
            else
            {
                state.SkipOffset = -1;
            }
            LastDocID = 0;
            Df        = 0;
        }
            public SegmentDocsAndPositionsEnum Reset(FieldInfo fieldInfo, StandardTermState termState, IBits liveDocs)
            {
                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert(fieldInfo.IndexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
                    Debugging.Assert(!fieldInfo.HasPayloads);
                }

                this.liveDocs = liveDocs;

                // TODO: for full enum case (eg segment merging) this
                // seek is unnecessary; maybe we can avoid in such
                // cases
                freqIn.Seek(termState.freqOffset);
                lazyProxPointer = termState.proxOffset;

                limit = termState.DocFreq;
                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert(limit > 0);
                }

                ord      = 0;
                doc      = -1;
                accum    = 0;
                position = 0;

                skipped         = false;
                posPendingCount = 0;

                freqOffset = termState.freqOffset;
                proxOffset = termState.proxOffset;
                skipOffset = termState.skipOffset;
                // if (DEBUG) System.out.println("StandardR.D&PE reset seg=" + segment + " limit=" + limit + " freqFP=" + freqOffset + " proxFP=" + proxOffset);

                return(this);
            }
Beispiel #11
0
        public override void EncodeTerm(long[] empty, DataOutput @out, FieldInfo fieldInfo, BlockTermState state, bool absolute)
        {
            StandardTermState state_ = (StandardTermState)state;

            if (absolute)
            {
                lastState = emptyState;
            }
            @out.WriteVInt64(state_.FreqStart - lastState.FreqStart);
            if (state_.SkipOffset != -1)
            {
                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert(state_.SkipOffset > 0);
                }
                @out.WriteVInt64(state_.SkipOffset);
            }
            // LUCENENET specific - to avoid boxing, changed from CompareTo() to IndexOptionsComparer.Compare()
            if (IndexOptionsComparer.Default.Compare(indexOptions, IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
            {
                @out.WriteVInt64(state_.ProxStart - lastState.ProxStart);
            }
            lastState = state_;
        }
            public virtual SegmentFullPositionsEnum Reset(FieldInfo fieldInfo, StandardTermState termState, Bits liveDocs)
            {
                StoreOffsets = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
                StorePayloads = fieldInfo.HasPayloads();
                Debug.Assert(fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
                Debug.Assert(StorePayloads || StoreOffsets);
                if (Payload_Renamed == null)
                {
                    Payload_Renamed = new BytesRef();
                    Payload_Renamed.Bytes = new byte[1];
                }

                this.LiveDocs = liveDocs;

                // TODO: for full enum case (eg segment merging) this
                // seek is unnecessary; maybe we can avoid in such
                // cases
                FreqIn.Seek(termState.FreqOffset);
                LazyProxPointer = termState.ProxOffset;

                Limit = termState.DocFreq;
                Ord = 0;
                Doc = -1;
                Accum = 0;
                Position = 0;
                StartOffset_Renamed = 0;

                Skipped = false;
                PosPendingCount = 0;
                PayloadPending = false;

                FreqOffset = termState.FreqOffset;
                ProxOffset = termState.ProxOffset;
                SkipOffset = termState.SkipOffset;
                //System.out.println("StandardR.D&PE reset seg=" + segment + " limit=" + limit + " freqFP=" + freqOffset + " proxFP=" + proxOffset + " this=" + this);

                return this;
            }
            public SegmentDocsAndPositionsEnum Reset(FieldInfo fieldInfo, StandardTermState termState, Bits liveDocs)
            {
                Debug.Assert(fieldInfo.FieldIndexOptions == FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
                Debug.Assert(!fieldInfo.HasPayloads());

                this.LiveDocs = liveDocs;

                // TODO: for full enum case (eg segment merging) this
                // seek is unnecessary; maybe we can avoid in such
                // cases
                FreqIn.Seek(termState.FreqOffset);
                LazyProxPointer = termState.ProxOffset;

                Limit = termState.DocFreq;
                Debug.Assert(Limit > 0);

                Ord = 0;
                Doc = -1;
                Accum = 0;
                Position = 0;

                Skipped = false;
                PosPendingCount = 0;

                FreqOffset = termState.FreqOffset;
                ProxOffset = termState.ProxOffset;
                SkipOffset = termState.SkipOffset;
                // if (DEBUG) System.out.println("StandardR.D&PE reset seg=" + segment + " limit=" + limit + " freqFP=" + freqOffset + " proxFP=" + proxOffset);

                return this;
            }
            internal virtual DocsEnum Reset(FieldInfo fieldInfo, StandardTermState termState)
            {
                IndexOmitsTF = fieldInfo.FieldIndexOptions == FieldInfo.IndexOptions.DOCS_ONLY;
                StorePayloads = fieldInfo.HasPayloads();
                StoreOffsets = fieldInfo.FieldIndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
                FreqOffset = termState.FreqOffset;
                SkipOffset = termState.SkipOffset;

                // TODO: for full enum case (eg segment merging) this
                // seek is unnecessary; maybe we can avoid in such
                // cases
                FreqIn.Seek(termState.FreqOffset);
                Limit = termState.DocFreq;
                Debug.Assert(Limit > 0);
                Ord = 0;
                Doc = -1;
                Accum = 0;
                // if (DEBUG) System.out.println("  sde limit=" + limit + " freqFP=" + freqOffset);
                Skipped = false;

                Start = -1;
                Count = 0;
                Freq_Renamed = 1;
                if (IndexOmitsTF)
                {
                    CollectionsHelper.Fill(Freqs, 1);
                }
                MaxBufferedDocId = -1;
                return this;
            }
 private DocsEnum NewDocsEnum(Bits liveDocs, FieldInfo fieldInfo, StandardTermState termState)
 {
     if (liveDocs == null)
     {
         return (new AllDocsSegmentDocsEnum(this, FreqIn)).Reset(fieldInfo, termState);
     }
     else
     {
         return (new LiveDocsSegmentDocsEnum(this, FreqIn, liveDocs)).Reset(fieldInfo, termState);
     }
 }
 public override object Clone()
 {
     StandardTermState other = new StandardTermState();
     other.CopyFrom(this);
     return other;
 }
        // Currently, this instance is re-used across fields, so
        // our parent calls setField whenever the field changes
        public override int SetField(FieldInfo fieldInfo)
        {
            //System.out.println("SPW: setField");
            /*
            if (BlockTreeTermsWriter.DEBUG && fieldInfo.Name.equals("id")) {
              DEBUG = true;
            } else {
              DEBUG = false;
            }
            */
            this.FieldInfo = fieldInfo;
            IndexOptions = fieldInfo.FieldIndexOptions;

            StoreOffsets = IndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
            StorePayloads = fieldInfo.HasPayloads();
            LastState = EmptyState;
            //System.out.println("  set init blockFreqStart=" + freqStart);
            //System.out.println("  set init blockProxStart=" + proxStart);
            return 0;
        }
 public override void EncodeTerm(long[] empty, DataOutput @out, FieldInfo fieldInfo, BlockTermState _state, bool absolute)
 {
     StandardTermState state = (StandardTermState)_state;
     if (absolute)
     {
         LastState = EmptyState;
     }
     @out.WriteVLong(state.FreqStart - LastState.FreqStart);
     if (state.SkipOffset != -1)
     {
         Debug.Assert(state.SkipOffset > 0);
         @out.WriteVLong(state.SkipOffset);
     }
     if (IndexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
     {
         @out.WriteVLong(state.ProxStart - LastState.ProxStart);
     }
     LastState = state;
 }