public override DocsEnum Docs(FieldInfo field, BlockTermState _termState, Bits liveDocs, DocsEnum reuse, int flags) { var termState = (PulsingTermState)_termState; if (termState.PostingsSize != -1) { PulsingDocsEnum postings; if (reuse is PulsingDocsEnum) { postings = (PulsingDocsEnum)reuse; if (!postings.CanReuse(field)) { postings = new PulsingDocsEnum(field); } } else { // the 'reuse' is actually the wrapped enum var previous = (PulsingDocsEnum)GetOther(reuse); if (previous != null && previous.CanReuse(field)) { postings = previous; } else { postings = new PulsingDocsEnum(field); } } if (reuse != postings) { SetOther(postings, reuse); // postings.other = reuse } return(postings.Reset(liveDocs, termState)); } if (!(reuse is PulsingDocsEnum)) { return(_wrappedPostingsReader.Docs(field, termState.WrappedTermState, liveDocs, reuse, flags)); } var wrapped = _wrappedPostingsReader.Docs(field, termState.WrappedTermState, liveDocs, GetOther(reuse), flags); SetOther(wrapped, reuse); // wrapped.other = reuse return(wrapped); }
public override DocsEnum Docs(FieldInfo field, BlockTermState _termState, Bits liveDocs, DocsEnum reuse, int flags) { PulsingTermState termState = (PulsingTermState) _termState; if (termState.PostingsSize != -1) { PulsingDocsEnum postings; if (reuse is PulsingDocsEnum) { postings = (PulsingDocsEnum) reuse; if (!postings.CanReuse(field)) { postings = new PulsingDocsEnum(field); } } else { // the 'reuse' is actually the wrapped enum PulsingDocsEnum previous = (PulsingDocsEnum) GetOther(reuse); if (previous != null && previous.CanReuse(field)) { postings = previous; } else { postings = new PulsingDocsEnum(field); } } if (reuse != postings) { SetOther(postings, reuse); // postings.other = reuse } return postings.Reset(liveDocs, termState); } else { if (reuse is PulsingDocsEnum) { DocsEnum wrapped = _wrappedPostingsReader.Docs(field, termState.WrappedTermState, liveDocs, GetOther(reuse), flags); SetOther(wrapped, reuse); // wrapped.other = reuse return wrapped; } else { return _wrappedPostingsReader.Docs(field, termState.WrappedTermState, liveDocs, reuse, flags); } } }