Ejemplo n.º 1
0
            public SimpleTextDocsAndPositionsEnum Reset(long fp, Bits liveDocs, IndexOptions indexOptions, int docFreq)
            {
                _liveDocs      = liveDocs;
                _nextDocStart  = fp;
                _docId         = -1;
                _readPositions = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
                _readOffsets   = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;

                if (!_readOffsets)
                {
                    _startOffset = -1;
                    _endOffset   = -1;
                }
                _cost = docFreq;
                return(this);
            }
Ejemplo n.º 2
0
            public override DocsAndPositionsEnum DocsAndPositions(Bits liveDocs, DocsAndPositionsEnum reuse, int flags)
            {
                if (_indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
                {
                    // Positions were not indexed
                    return(null);
                }

                SimpleTextDocsAndPositionsEnum docsAndPositionsEnum;

                if (reuse != null && reuse is SimpleTextDocsAndPositionsEnum && ((SimpleTextDocsAndPositionsEnum)reuse).CanReuse(_outerInstance._input))
                {
                    docsAndPositionsEnum = (SimpleTextDocsAndPositionsEnum)reuse;
                }
                else
                {
                    docsAndPositionsEnum = new SimpleTextDocsAndPositionsEnum(_outerInstance);
                }
                return(docsAndPositionsEnum.Reset(_docsStart, liveDocs, _indexOptions, _docFreq));
            }