Hi,

I'm currently working with Lucene 2.3.1.

The aim of my application is to querying(from an HTML form) my lucene index, then displaying results (in a web page)with:
 - Matching Strings
 - Matching String positions / offsets

For example:
-The document:
when i was a child, i was a Jedi.

-The query:
w*

I would like to obtain something like:
 - 3 results
 - matching strings: when, was, was
 -offsets: 0-3; 7-9; 22-24

I've tried to use the TermPositionVector class:
[...]
Hits hits = searcher.search(query);
for (int i = 0; i < hitCount; i++) {
TermPositionVector tfv = (TermPositionVector) searcher.getIndexReader().getTermFreqVector(hits.id(i), "content");
[...]


I will be able to get positions with this vector, but at first, I have to get the matching strings (when, war for the "w*" query).

According to you, what is the easier way ?

Thank you


Jérôme

Reply via email to