Lucene不返回复杂查询的偏移量

Lucene不返回复杂查询的偏移量,lucene,Lucene,我在android应用程序中使用Lucene进行搜索,但当我运行复杂查询时,它不会返回术语的偏移量 例如: +content:"word" +(personid:NULL personid:123) +content:"word" +(personid:NULL) +content:"word" -personid:123 不会为“字”返回任何偏移量 将返回偏移量 以下是我在每个字段中存储的内容 doc.add(new Field(PERSON_ID_FIELD, request.getPe

我在android应用程序中使用Lucene进行搜索,但当我运行复杂查询时,它不会返回术语的偏移量

例如:

+content:"word" +(personid:NULL personid:123)
+content:"word" +(personid:NULL)
+content:"word" -personid:123
不会为“字”返回任何偏移量

将返回偏移量

以下是我在每个字段中存储的内容

 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));
我错过什么了吗?在查询中是否需要执行某些操作才能恢复偏移量


谢谢。

如果试图从带有
personid的术语的内容字段中获取偏移量,则不会返回任何偏移量。然后,如果不循环查询中的整个术语列表,就永远无法找到查询的内容术语。因此,不会返回偏移量。

您是如何尝试检索偏移量的?我正在获取内容字段的TermVector,然后在查询中询问每个术语的偏移量。@jpountz谢谢您回答我需要的问题。
 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));