lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Victor Hadianto <>
Subject Going through the hits while updating the index.
Date Thu, 23 May 2002 08:48:14 GMT
Well it's me again :D

I have a funny feeling that this might not be recommended to do in Lucene. 
Basically what I'm doing is search the index and for each document I need to 
do an update of the field. Thus deleting the index and readding it again. 

Is this OK to do?

A bit of code might help illustrate my situation:

IndexSearcher searcher = new IndexSearcer(dir);

Hits hits =;

for (int i = 0; i < hits.length(); i++) {

	.... get the document and do modification here

	IndexReader reader = new IndexReader(dir);
	reader.delete(new Term("id", doc.get("id");

	IndexWriter writer = new IndexWriter( ... );


Is this OK? or I am not suppose to update the writer while looping through 
the hits? 

Victor Hadianto

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

View raw message