private void GetPayloads(ICollection <byte[]> payloads, SpanQuery query) { IDictionary <Term, TermContext> termContexts = new Dictionary <Term, TermContext>(); var terms = new JCG.SortedSet <Term>(); query.ExtractTerms(terms); foreach (Term term in terms) { termContexts[term] = TermContext.Build(context, term); } foreach (AtomicReaderContext atomicReaderContext in context.Leaves) { Spans spans = query.GetSpans(atomicReaderContext, atomicReaderContext.AtomicReader.LiveDocs, termContexts); while (spans.MoveNext() == true) { if (spans.IsPayloadAvailable) { var payload = spans.GetPayload(); foreach (var bytes in payload) { payloads.Add(bytes); } } } } }