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 = search.search(query);

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");
        reader.close();

        IndexWriter writer = new IndexWriter( ... );
        writer.add(doc);
        writer.close();
}

searcher.close();


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

-- 
Victor Hadianto

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to