lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andi Vajda <>
Subject renaming IndexReader.delete() ?
Date Mon, 05 Dec 2005 20:04:03 GMT

Since Lucene 1.9 is a long-awaited release where we're considering deprecating 
some APIs, how about renaming and deprecating IndexReader.delete() as follows:

  - IndexReader.delete(int)  -> IndexReader.deleteDocument(int)
  - IndexReader.delete(Term) -> IndexReader.deleteDocuments(Term)

There are several reasons for doing that:

  - For the PyLucene project, a python wrapper of java Lucene built with gcj
    and swig (, this API is a problem because
    'delete' is a reserved keyword in both python and C++.
    This causes me to rename the API by patching the java Lucene source code
    before compiling it.
    PyLucene 1.9, now under development, is built against the java Lucene HEAD
    subversion revision. Maintaining patches against a moving target is very
    brittle, I'd like to keep the number of patches down to a minimum,
    typically only those caused by bugs in gcj.
    (see for the
     current set of patches).

  - It would also be better if the java APIs and the python APIs where the
    same, that way the java API documentation can be easily leveraged by python
    In other words, it would be a great long term goal for the Lucene APIs to
    be more portable to other languages such as C++, python, ruby, etc...

Taken by themselves, however, these reasons are still a little too weak to 
make a java Lucene API change since better gcj/c++/python support doesn't 
directly affect java programmers anyway. But:

  - This API is badly named to begin with. IndexReader.delete() would imply
    that you're deleting the index reader whereas you're actually deleting one
    or more documents.

I think it would be an improvement for the java Lucene API to be more explicit 
about what IndexReader.delete() is doing:

   - IndexReader.deleteDocument(int) deletes the ONE document behind the docid
     passed in.
   - IndexReader.deleteDocuments(Term) deletes ALL documents containing the
     term passed in.

I have a patch ready to submit if consensus around approving this change can 
be found. I already filed a bug about this a long time ago,, but the patch attached 
there is stale now.

What do you think ?


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

View raw message