Martin,

Note that the documents within each index segment (leaf context) are zero
indexed.  Meaning that each segment in your index will contain a different
document with a segment-relative docId of 0.

When working inleaf context, you can calculate a document's absolute docId
with something like: "int absoluteDocId = context.docBase + docId;".

-Greg



On Tue, Apr 1, 2014 at 5:52 PM, Martin Líška <djmatoli...@gmail.com> wrote:

> Dear all,
>
> I'm experiencing troubles with SpanTermQuery.getSpans(AtomicReaderContext
> context, Bits acceptDocs, Map<Term,TermContext> termContexts) method in
> version 4.6. I want to use it to retrieve payloads of matched spans.
>
> First, I search the index with IndexSearcher.search(query, limit) and I get
> TopDocs. In these TopDocs, there is a certain document A. I know, that the
> query is an instance of PayloadTermQuery, so I search for spans
> using query.getSpans(indexReader.leaves().get(0), null, new HashMap()); but
> this wont return the spans for the document A.
>
> I observed, that getSpans method won't return any spans for documents with
> IDs greater than say 900, even though documents with IDs greater than 900
> were returned in the original search. All other documents below ID 900 are
> returned sucessfully from getSpans method.
>
> I also tried passing all the leaves of indexReader to getSpans with no
> effect.
>
> Please help.
>
> Thank you
>

Reply via email to