lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <>
Subject 2.9 and IndexReader deletions
Date Fri, 23 Oct 2009 15:28:03 GMT
I'm going through and updating my Lucene Boot Camp training for 2.9.   
In it, I have some code that shows the various ways you can do deletes.

In 2.4, the code worked fine, in 2.9 it now fails.  Here's the code:
public void testDeletions() throws Exception {"----------------testDeletions()-------------");
     //we should have indexed already
     IndexReader reader =, false);
     assertTrue("reader is null and it shouldn't be", reader != null);
     Document doc = reader.document(0);
     assertTrue("doc is null and it shouldn't be", doc != null);
     assertTrue(reader.isDeleted(0) + " does not equal: " + true,  
reader.isDeleted(0) == true);
     try {
       doc = reader.document(0); //verify the document is not  
       assertTrue(doc.toString(), false);
     } catch (IllegalArgumentException e) {

     }"----------------end testDeletions()-------------");

This is, of course, due to LUCENE-1708:

* LUCENE-1708 - IndexReader.document() no longer checks if the  
document is
     deleted. You can call IndexReader.isDeleted(n) prior to calling  
     (Shai Erera via Mike McCandless)

However, it seems like this is a break in back-compat as it requires  
people to actively change their code.  Granted, my test case is  
admittedly contrived, but I wonder if other people come across this.   
I understand that I'm not going to find (search) a deleted document so  
in most cases it's not a big deal, but plenty of people use Lucene as  
a document store, too, and may access documents directly such that  
their code may now well be broken.

Anyone against me moving the issue from the Runtime changes section to  
the Back Compat section?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message