Dear  All

I need  help  to  update the index created for the database search

I created the index with  three field  mapping to the three column of 
database(oid(primarykey),title, contents)
Then I created the document for each row and added to the writer      

    doc.add(Field.Keyword("OID",oid+""));
    doc.add(Field.Text("title",title));
    doc.add(Field.Text("contents",contents));
    writer.addDocument(doc);

Here search is only on  title and the contents and oid is the key to retrieve the 
details from the database.

Later if the "contents" column in the database is  updated. We have to updated the 
content in the index also

If I use the writer with false

IndexWriter writer = new IndexWriter("C\index", new StandardAnalyzer(),false);

then all the record are inserted in to index without deleting the old index causing 
duplication 


If I use the writer with true

IndexWriter writer = new IndexWriter("C\index", new StandardAnalyzer(),false);

then record are inserted in to index deleting all the old index.

My question is 
1) How to update the existing index 
2) When I fetch the rows from the database in order to update or insert in index how 
to know which record is modified in database and which record is not present is index

Thanks is advance
Raju

Reply via email to