lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Position of a word in a document?
Date Tue, 16 May 2006 23:42:21 GMT

: There is a "TermPositions pos = reader.termPositions();" [reader is an
: instance of IndexReader] - but I have no clue, how to get a position of
: a hit in a document. What can I do with TermPosition?
: So, I have all hits of my query with "Hits hits =
:;" - with the help of "hits" I know the
: document(s) where I can find my query ... but how can I retrieve the
: position now?!

Start by understanding the TermDocs API -- TermPositions subclasses it.
TermDocs provides a way to iterate over docid,frequency pirs ..
TermPositions adds another dimension to the iteration by letting you
iterate over the positions within the document that a term appears in.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message