Exemplo n.º 1
0
            internal TermsReader(FSTOrdTermsReader outerInstance, FieldInfo fieldInfo, IndexInput blockIn, long numTerms, long sumTotalTermFreq, long sumDocFreq, int docCount, int longsSize, FST <long> index)
            {
                this.outerInstance    = outerInstance;
                this.fieldInfo        = fieldInfo;
                this.numTerms         = numTerms;
                this.sumTotalTermFreq = sumTotalTermFreq;
                this.sumDocFreq       = sumDocFreq;
                this.docCount         = docCount;
                this.longsSize        = longsSize;
                this.index            = index;

                Debug.Assert((numTerms & (~0xffffffffL)) == 0);
                int numBlocks = (int)(numTerms + INTERVAL - 1) / INTERVAL;

                this.numSkipInfo    = longsSize + 3;
                this.skipInfo       = new long[numBlocks * numSkipInfo];
                this.statsBlock     = new sbyte[(int)blockIn.ReadVLong()];
                this.metaLongsBlock = new sbyte[(int)blockIn.ReadVLong()];
                this.metaBytesBlock = new sbyte[(int)blockIn.ReadVLong()];

                int last = 0, next = 0;

                for (int i = 1; i < numBlocks; i++)
                {
                    next = numSkipInfo * i;
                    for (int j = 0; j < numSkipInfo; j++)
                    {
                        skipInfo[next + j] = skipInfo[last + j] + blockIn.ReadVLong();
                    }
                    last = next;
                }
                blockIn.ReadBytes(statsBlock, 0, statsBlock.Length);
                blockIn.ReadBytes(metaLongsBlock, 0, metaLongsBlock.Length);
                blockIn.ReadBytes(metaBytesBlock, 0, metaBytesBlock.Length);
            }
Exemplo n.º 2
0
        public override FieldsProducer FieldsProducer(SegmentReadState state)
        {
            PostingsReaderBase postingsReader = new Lucene41PostingsReader(state.Directory, state.FieldInfos,
                                                                           state.SegmentInfo, state.Context, state.SegmentSuffix);
            bool success = false;

            try
            {
                FieldsProducer ret = new FSTOrdTermsReader(state, postingsReader);
                success = true;
                return(ret);
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(postingsReader);
                }
            }
        }
        public override FieldsProducer FieldsProducer(SegmentReadState state)
        {
            PostingsReaderBase docsReader    = null;
            PostingsReaderBase pulsingReader = null;
            bool success = false;

            try
            {
                docsReader    = _wrappedPostingsBaseFormat.PostingsReaderBase(state);
                pulsingReader = new PulsingPostingsReader(state, docsReader);
                FieldsProducer ret = new FSTOrdTermsReader(state, pulsingReader);
                success = true;
                return(ret);
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(docsReader, pulsingReader);
                }
            }
        }
Exemplo n.º 4
0
            internal TermsReader(FSTOrdTermsReader outerInstance, FieldInfo fieldInfo, IndexInput blockIn, long numTerms, long sumTotalTermFreq, long sumDocFreq, int docCount, int longsSize, FST <long?> index)
            {
                this.outerInstance    = outerInstance;
                this.fieldInfo        = fieldInfo;
                this.numTerms         = numTerms;
                this.sumTotalTermFreq = sumTotalTermFreq;
                this.sumDocFreq       = sumDocFreq;
                this.docCount         = docCount;
                this.longsSize        = longsSize;
                this.index            = index;

                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert((numTerms & (~0xffffffffL)) == 0);
                }
                int numBlocks = (int)(numTerms + INTERVAL - 1) / INTERVAL;

                this.numSkipInfo    = longsSize + 3;
                this.skipInfo       = new long[numBlocks * numSkipInfo];
                this.statsBlock     = new byte[(int)blockIn.ReadVInt64()];
                this.metaLongsBlock = new byte[(int)blockIn.ReadVInt64()];
                this.metaBytesBlock = new byte[(int)blockIn.ReadVInt64()];

                int last = 0, next; // LUCENENET: IDE0059: Remove unnecessary value assignment

                for (int i = 1; i < numBlocks; i++)
                {
                    next = numSkipInfo * i;
                    for (int j = 0; j < numSkipInfo; j++)
                    {
                        skipInfo[next + j] = skipInfo[last + j] + blockIn.ReadVInt64();
                    }
                    last = next;
                }
                blockIn.ReadBytes(statsBlock, 0, statsBlock.Length);
                blockIn.ReadBytes(metaLongsBlock, 0, metaLongsBlock.Length);
                blockIn.ReadBytes(metaBytesBlock, 0, metaBytesBlock.Length);
            }