Delay Problem Adding a document to existing index

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Delay Problem Adding a document to existing index

sunildm4u
Hi I am new to lucene..In my project we are implementing serch engine through lucene.we have lacs of records.The problem is Once if i index 50000 records its takes approximation 20 min. Now thnk i want to add 5 more records to database. if i use IndexWriter indexWriter = new IndexWriter(getFilePath(), getAnalyzer(),false) Then also its creating all the index from sctratch.. which again takes 20 min for extra 5 records.. Its not affordable does any one has a solution for this.. i am sending the code for your reference IndexWriter indexWriter = new IndexWriter(getFilePath(), getAnalyzer(),false); while (resultSet.next()) { Document document = new Document(); document.add(new Field("Surname", resultSet.getString("NAME_1"),Field.Store.YES,Field.Index.TOKENIZED)); indexWriter.addDocument(document); count= count+1; System.out.println("indexed :" + count + " " + resultSet.getString("NAME_1")); } indexWriter.optimize(); indexWriter.close();
Loading...