I am using Lucene for searching in my android app but when I run a complex query it doesn’t return offsets for the terms.
For example:
+content:"word" +(personid:NULL personid:123)
+content:"word" +(personid:NULL)
+content:"word" -personid:123
will not return any offsets for the “word”.
+content:word
Will return offsets.
here is what I am storing in each field
doc.add(new Field(PERSON_ID_FIELD, request.getPersonId(), Field.Store.YES, Field.Index.NOT_ANALYZED));
// we don't actually store the content here
doc.add(new Field(CONTENT_FIELD, request.getContent(), Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.WITH_OFFSETS));
Am I missing something? Is there something I need to do in the query to get offsets back?
Thanks.
If one tries to get an offset from the content field for the term with
personidit doesn’t return any offsets. Then by not looping through the entire term list from the query one never gets to the content term of the query. Thus no offsets are returned.