lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Santanu Debnath" <citytechd...@citytechcorp.com>
Subject Update Document In existing Index File
Date Tue, 30 Jul 2013 14:09:18 GMT
Hello 

 

I'm using Lucene.Net(V 2.9) in my application. I'm trying to  create an
index file and then update(add, edit and delete document) in existing index
file. 

The index file is creating successfully but when I've trying to update in
the existing index file it is not updating in existing index file instead-of
created new index file. 

It also deleting the previous index file. 

 

For updating in document I've written the following code. 

 

IndexWriter indexWriter = new IndexWriter(this._fullFeedFilePath, new
Lucene.Net.Analysis.Standard.StandardAnalyzer(),false);

Lucene.Net.Documents.Document newIndexDoc = new
Lucene.Net.Documents.Document();

ProcessPrimaryData(dataCollection, newIndexDoc);

indexWriter.AddDocument(newIndexDoc);

indexWriter.Optimize();

indexWriter.Close();

 

in this._fullFeedFilePath contains the directory path where the index file
exist. 

The index file is deleting at the time of IndexWriter initialization. Ie in 

 

IndexWriter indexWriter = new IndexWriter(this._fullFeedFilePath, new
Lucene.Net.Analysis.Standard.StandardAnalyzer(),false);

 

In IndexWtirer initialization, It always executing following lines and
delete old existing index file .

 

// Default deleter (for backwards compatibility) is

// KeepOnlyLastCommitDeleter:

deleter = new IndexFileDeleter(directory, deletionPolicy == null?new
KeepOnlyLastCommitDeletionPolicy():deletionPolicy, segmentInfos, infoStream,
docWriter); 

 

May you suggest what I'm doing wrong for update in the existing index file .

 

Please reply as soon as possible. 

 

 

 

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message