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
  • 72,334
  • 18
  • 180
  • 242
Mahdi Amrollahi
  • 2,788
  • 5
  • 25
  • 35

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
  • 11,855
  • 5
  • 35
  • 46