lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felipe Sánchez Martínez <>
Subject In which position of a document a word was found?
Date Wed, 13 Jun 2007 17:36:19 GMT
Hi all,

I am new to Lucene and I have been reading the book "Lucene In Action",
here is my question:

When searching for a word through an index is there any way to know in
which positions (may be more than one) of each document that word was

The index is constructed in the following way:
IndexWriter writer = new IndexWriter("/path/to/the/index/dir", 
new StandardAnalyzer(), true);


Document doc = new Document();

doc.add(new Field("contents", 
new FileReader(f),Field.TermVector.WITH_POSITIONS_OFFSETS));

doc.add(new Field("filename", f.getCanonicalPath(), Field.Store.YES,


Thanks in advance

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

View raw message