lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felipe Sánchez Martínez <fsanc...@dlsi.ua.es>
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
found?

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

writer.setUseCompoundFile(false);

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,
Field.Index.NO_NORMS));

writer.addDocument(doc);
.....
--------------------


Thanks in advance
--
Felipe.



---------------------------------------------------------------------
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