tags:

views:

94

answers:

1

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 ?

+2  A: 

Try this:

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

See http://lucene.apache.org/java/2_4_0/api/org/apache/lucene/index/TermPositionVector.html on how to use TermPositionVector to get the info you want.

bajafresh4life