this.needsOffsets = PostingsEnum.featureRequested(flags, PostingsEnum.OFFSETS); this.needsPayloads = PostingsEnum.featureRequested(flags, PostingsEnum.PAYLOADS);
public PostingsEnum reset(IntBlockTermState termState, int flags) throws IOException { docFreq = termState.docFreq; totalTermFreq = indexHasFreq ? termState.totalTermFreq : docFreq; docTermStartFP = termState.docStartFP; skipOffset = termState.skipOffset; singletonDocID = termState.singletonDocID; if (docFreq > 1) { if (docIn == null) { // lazy init docIn = startDocIn.clone(); } docIn.seek(docTermStartFP); } doc = -1; this.needsFreq = PostingsEnum.featureRequested(flags, PostingsEnum.FREQS); if (indexHasFreq == false || needsFreq == false) { Arrays.fill(freqBuffer, 1); } accum = 0; docUpto = 0; nextSkipDoc = BLOCK_SIZE - 1; // we won't skip if target is found in first block docBufferUpto = BLOCK_SIZE; skipped = false; return this; }
@Override public PostingsEnum postings(PostingsEnum reuse, int flags) { if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { FreqProxPostingsEnum posEnum; if (!terms.hasOffsets && PostingsEnum.featureRequested(flags, PostingsEnum.OFFSETS)) { if (!terms.hasFreq && PostingsEnum.featureRequested(flags, PostingsEnum.FREQS)) {
@Override public PostingsEnum postings( PostingsEnum reuse, final int flags) throws IOException { if (hasPositions && PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { final PostingsEnum inReuse; final SortingPostingsEnum wrapReuse; final boolean withFreqs = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS) >=0 && PostingsEnum.featureRequested(flags, PostingsEnum.FREQS); return new SortingDocsEnum(docMap.size(), wrapReuse, inDocs, withFreqs, docMap);
boolean indexHasPayloads = fieldInfo.hasPayloads(); if (indexHasPositions == false || PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS) == false) { BlockDocsEnum docsEnum; if (reuse instanceof BlockDocsEnum) { } else if ((indexHasOffsets == false || PostingsEnum.featureRequested(flags, PostingsEnum.OFFSETS) == false) && (indexHasPayloads == false || PostingsEnum.featureRequested(flags, PostingsEnum.PAYLOADS) == false)) { BlockPostingsEnum docsAndPositionsEnum; if (reuse instanceof BlockPostingsEnum) {
@Override public PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException { if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { SimpleTVPostings postings = current.getValue(); if (postings.positions != null || postings.startOffsets != null) { // TODO: reuse SimpleTVPostingsEnum e = new SimpleTVPostingsEnum(); e.reset(postings.positions, postings.startOffsets, postings.endOffsets, postings.payloads); return e; } } // TODO: reuse SimpleTVDocsEnum e = new SimpleTVDocsEnum(); e.reset(PostingsEnum.featureRequested(flags, PostingsEnum.FREQS) == false ? 1 : current.getValue().freq); return e; }
public PostingsEnum reset(IntBlockTermState termState, int flags) throws IOException { docFreq = termState.docFreq; totalTermFreq = indexHasFreq ? termState.totalTermFreq : docFreq; docTermStartFP = termState.docStartFP; skipOffset = termState.skipOffset; singletonDocID = termState.singletonDocID; if (docFreq > 1) { if (docIn == null) { // lazy init docIn = startDocIn.clone(); } docIn.seek(docTermStartFP); } doc = -1; this.needsFreq = PostingsEnum.featureRequested(flags, PostingsEnum.FREQS); if (indexHasFreq == false || needsFreq == false) { Arrays.fill(freqBuffer, 1); } accum = 0; docUpto = 0; nextSkipDoc = BLOCK_SIZE - 1; // we won't skip if target is found in first block docBufferUpto = BLOCK_SIZE; skipped = false; return this; }
@Override public final PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException { if (PostingsEnum.featureRequested(flags, DocsAndPositionsEnum.OLD_NULL_SEMANTICS)) { if (positions == null && startOffsets == null) { return null; } } final TVDocsEnum docsEnum; if (reuse != null && reuse instanceof TVDocsEnum) { docsEnum = (TVDocsEnum) reuse; } else { docsEnum = new TVDocsEnum(); } docsEnum.reset(termFreqs[ord], positionIndex[ord], positions, startOffsets, lengths, payloads, payloadIndex); return docsEnum; }
@Override public final PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException { if (PostingsEnum.featureRequested(flags, DocsAndPositionsEnum.OLD_NULL_SEMANTICS)) { if (positions == null && startOffsets == null) { // Positions nor offsets were indexed: return null; } } final TVPostingsEnum docsEnum; if (reuse != null && reuse instanceof TVPostingsEnum) { docsEnum = (TVPostingsEnum) reuse; } else { docsEnum = new TVPostingsEnum(); } docsEnum.reset(termFreqs[ord], positionIndex[ord], positions, startOffsets, lengths, payloads, payloadIndex); return docsEnum; }
@Override public final PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException { if (PostingsEnum.featureRequested(flags, DocsAndPositionsEnum.OLD_NULL_SEMANTICS)) { if (positions == null && startOffsets == null) { // Positions nor offsets were indexed: return null; } } final TVPostingsEnum docsEnum; if (reuse != null && reuse instanceof TVPostingsEnum) { docsEnum = (TVPostingsEnum) reuse; } else { docsEnum = new TVPostingsEnum(); } docsEnum.reset(termFreqs[ord], positionIndex[ord], positions, startOffsets, lengths, payloads, payloadIndex); return docsEnum; }
public PostingsEnum reset(IntBlockTermState termState, int flags) throws IOException { docFreq = termState.docFreq; totalTermFreq = indexHasFreq ? termState.totalTermFreq : docFreq; docTermStartFP = termState.docStartFP; skipOffset = termState.skipOffset; singletonDocID = termState.singletonDocID; if (docFreq > 1) { if (docIn == null) { // lazy init docIn = startDocIn.clone(); } docIn.seek(docTermStartFP); } doc = -1; this.needsFreq = PostingsEnum.featureRequested(flags, PostingsEnum.FREQS); if (indexHasFreq == false || needsFreq == false) { Arrays.fill(freqBuffer, 1); } accum = 0; docUpto = 0; nextSkipDoc = BLOCK_SIZE - 1; // we won't skip if target is found in first block docBufferUpto = BLOCK_SIZE; skipped = false; return this; }
public PostingsEnum reset(IntBlockTermState termState, int flags) throws IOException { docFreq = termState.docFreq; totalTermFreq = indexHasFreq ? termState.totalTermFreq : docFreq; docTermStartFP = termState.docStartFP; skipOffset = termState.skipOffset; singletonDocID = termState.singletonDocID; if (docFreq > 1) { if (docIn == null) { // lazy init docIn = startDocIn.clone(); } docIn.seek(docTermStartFP); } doc = -1; this.needsFreq = PostingsEnum.featureRequested(flags, PostingsEnum.FREQS); if (indexHasFreq == false || needsFreq == false) { Arrays.fill(freqBuffer, 1); } accum = 0; docUpto = 0; nextSkipDoc = BLOCK_SIZE - 1; // we won't skip if target is found in first block docBufferUpto = BLOCK_SIZE; skipped = false; return this; }
@Override public PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException { if (PostingsEnum.featureRequested(flags, DocsAndPositionsEnum.OLD_NULL_SEMANTICS) && fr.fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0) { // Positions were not indexed: return null; } currentFrame.decodeMetaData(); return fr.parent.postingsReader.postings(fr.fieldInfo, currentFrame.termState, reuse, flags); }
@Override public PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException { if (PostingsEnum.featureRequested(flags, DocsAndPositionsEnum.OLD_NULL_SEMANTICS) && fr.fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0) { // Positions were not indexed: return null; } assert !eof; //if (DEBUG) { //System.out.println("BTTR.docs seg=" + segment); //} currentFrame.decodeMetaData(); //if (DEBUG) { //System.out.println(" state=" + currentFrame.state); //} return fr.parent.postingsReader.postings(fr.fieldInfo, currentFrame.state, reuse, flags); }
@Override public PostingsEnum postings(FieldInfo fieldInfo, BlockTermState termState, PostingsEnum reuse, int flags) throws IOException { SingleDocsEnum docsEnum; if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { SinglePostingsEnum posEnum; if (reuse instanceof SinglePostingsEnum) { posEnum = (SinglePostingsEnum) reuse; } else { posEnum = new SinglePostingsEnum(); } IDVersionTermState _termState = (IDVersionTermState) termState; posEnum.reset(_termState.docID, _termState.idVersion); return posEnum; } if (reuse instanceof SingleDocsEnum) { docsEnum = (SingleDocsEnum) reuse; } else { docsEnum = new SingleDocsEnum(); } docsEnum.reset(((IDVersionTermState) termState).docID); return docsEnum; }
@Override public PostingsEnum postings(FieldInfo fieldInfo, BlockTermState termState, PostingsEnum reuse, int flags) throws IOException { SingleDocsEnum docsEnum; if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { SinglePostingsEnum posEnum; if (reuse instanceof SinglePostingsEnum) { posEnum = (SinglePostingsEnum) reuse; } else { posEnum = new SinglePostingsEnum(); } IDVersionTermState _termState = (IDVersionTermState) termState; posEnum.reset(_termState.docID, _termState.idVersion); return posEnum; } if (reuse instanceof SingleDocsEnum) { docsEnum = (SingleDocsEnum) reuse; } else { docsEnum = new SingleDocsEnum(); } docsEnum.reset(((IDVersionTermState) termState).docID); return docsEnum; }
@Override public PostingsEnum postings(FieldInfo fieldInfo, BlockTermState termState, PostingsEnum reuse, int flags) throws IOException { boolean hasPositions = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS) && hasPositions) { return fullPostings(fieldInfo, termState, reuse, flags); } if (canReuse(reuse)) { // if (DEBUG) System.out.println("SPR.docs ts=" + termState); return ((SegmentDocsEnumBase) reuse).reset(fieldInfo, (StandardTermState)termState); } return newDocsEnum(fieldInfo, (StandardTermState)termState); }
@Override public PostingsEnum postings(FieldInfo fieldInfo, BlockTermState termState, PostingsEnum reuse, int flags) throws IOException { boolean hasPositions = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; if (PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS) && hasPositions) return fullPostings(fieldInfo, termState, reuse, flags); BlockDocsEnum docsEnum; if (reuse instanceof BlockDocsEnum) { docsEnum = (BlockDocsEnum) reuse; if (!docsEnum.canReuse(docIn, fieldInfo)) { docsEnum = new BlockDocsEnum(fieldInfo); } } else { docsEnum = new BlockDocsEnum(fieldInfo); } return docsEnum.reset((IntBlockTermState) termState, flags); }
@Override public PostingsEnum postings(PostingsEnum reuse, int flags) throws IOException { boolean hasPositions = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; if (hasPositions && PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { SimpleTextPostingsEnum docsAndPositionsEnum; if (reuse != null && reuse instanceof SimpleTextPostingsEnum && ((SimpleTextPostingsEnum) reuse).canReuse(SimpleTextFieldsReader.this.in)) { docsAndPositionsEnum = (SimpleTextPostingsEnum) reuse; } else { docsAndPositionsEnum = new SimpleTextPostingsEnum(); } return docsAndPositionsEnum.reset(docsStart, indexOptions, docFreq); } SimpleTextDocsEnum docsEnum; if (reuse != null && reuse instanceof SimpleTextDocsEnum && ((SimpleTextDocsEnum) reuse).canReuse(SimpleTextFieldsReader.this.in)) { docsEnum = (SimpleTextDocsEnum) reuse; } else { docsEnum = new SimpleTextDocsEnum(); } return docsEnum.reset(docsStart, indexOptions == IndexOptions.DOCS, docFreq); }
if (hasPositions && PostingsEnum.featureRequested(flags, PostingsEnum.POSITIONS)) { boolean hasOffsets = field.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; decodeMetaData();