lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "anshum.gupta@naukri.com" <ansh...@gmail.com>
Subject Re: Index Growing on Delete
Date Fri, 22 Jan 2010 10:04:29 GMT
Hi Jamie,
You could try and debug using
IndexReader.numDeletedDocs() ;
On the index to check if the documents are expunged or not.

------Original Message------
From: Jamie
To: java-user@lucene.apache.org
ReplyTo: java-user@lucene.apache.org
Subject: Index Growing on Delete
Sent: Jan 22, 2010 14:04

Hi

In our application,on a periodic basis, documents get deleted from the 
index. Although the deleted documents correctly cannot be found when 
searching the index, our users are complaining that their hard drive is 
fulling up, since the index continues to grow in size despite the fact 
that the entries should be deleted from the index. I cannot understand 
why this is the case since I call both writer.expungeDeletes and 
writer.commit(). Any ideas?

Here is my delete function:

public void deleteDocs(Term[] terms) throws MessageSearchException {
               logger.debug("delete docs");
               try {
                   indexLock.lock();
                   openIndex();
                   try {
                       writer.deleteDocuments(terms);
                   } catch (Exception e) {
                       throw new MessageSearchException("failed to 
delete doc from index."+e.getMessage(),e,logger);
                   } finally {
                       try {
                           writer.expungeDeletes(false);
                           writer.commit();
                       } catch (Exception io) {
                           throw new MessageSearchException("failed to 
expunge docs from index"+io.getMessage(),io,logger);
                       }
                   }
               } catch (Throwable t) {
                   logger.error("failed to delete docs from 
index."+t.getMessage(),t);
               } finally {
                   indexLock.unlock();
               }
}

As an aside note, we are moving to Lucene 3.0 from 2.9. What is the 
equivalent of:

QueryParser queryParser = new QueryParser("body",analyzer);
and "Field.Index.TOKENIZED". If I change this, will my index maintain 
compatibility?


Thanks

Jamie


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org



--
Anshum
Sent from BlackBerry®
Mime
View raw message