lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
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 =
: searcher.search(query);" - 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.


-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message