4

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 ?

casperOne
  • 73,706
  • 19
  • 184
  • 253
Mahdi Amrollahi
  • 2,930
  • 5
  • 27
  • 37

1 Answers1

5

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.

Ken Egozi
  • 1,825
  • 11
  • 14
bajafresh4life
  • 12,491
  • 5
  • 37
  • 46