How get the offset of term in Lucene?

橙三吉。 提交于 2019-12-10 15:53:19

问题


I want to get the offset of one term in the Lucene . How can i get it ?

I vectored my content as

Field.TermVector.WITH_POSITIONS_OFFSETS

Is there any method in Lucene that give me offset of the term in one Document ?


回答1:


Try this:

TermPositionVector vector = (TermPositionVector) reader.getTermFreqVector(docId, myfield);

See http://lucene.apache.org/core/3_0_3/api/core/org/apache/lucene/index/TermPositionVector.html to get the info you want.



来源:https://stackoverflow.com/questions/2930339/how-get-the-offset-of-term-in-lucene

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!