public UnionDocsAndPositionsEnum(Bits liveDocs, AtomicReaderContext context, Term[] terms, IDictionary <Term, TermContext> termContexts, TermsEnum termsEnum) { ICollection <DocsAndPositionsEnum> docsEnums = new LinkedList <DocsAndPositionsEnum>(); for (int i = 0; i < terms.Length; i++) { Term term = terms[i]; TermState termState = termContexts[term].Get(context.Ord); if (termState == null) { // Term doesn't exist in reader continue; } termsEnum.SeekExact(term.Bytes(), termState); DocsAndPositionsEnum postings = termsEnum.DocsAndPositions(liveDocs, null, DocsEnum.FLAG_NONE); if (postings == null) { // term does exist, but has no positions throw new InvalidOperationException("field \"" + term.Field() + "\" was indexed without position data; cannot run PhraseQuery (term=" + term.Text() + ")"); } Cost_Renamed += postings.Cost(); docsEnums.Add(postings); } _queue = new DocsQueue(docsEnums); _posList = new IntQueue(); }