You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Andi Vajda <va...@osafoundation.org> on 2005/12/05 21:04:03 UTC

renaming IndexReader.delete() ?

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 (http://pylucene.osafoundation.org), 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 http://svn.osafoundation.org/pylucene/trunk/patches.lucene 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
    programmers.
    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, 
http://issues.apache.org/jira/browse/LUCENE-289, but the patch attached 
there is stale now.

What do you think ?

Andi..

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


Re: renaming IndexReader.delete() ?

Posted by Daniel Naber <lu...@danielnaber.de>.
On Montag 05 Dezember 2005 21:04, Andi Vajda wrote:

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

Yes, I like those names better than the current ones.

Regards
 Daniel

-- 
http://www.danielnaber.de

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


Re: renaming IndexReader.delete() ?

Posted by sl...@ccr.fr.
I certainly agree with this change!

We all have interest in having a clean and understandable API.




                                                                           
             Erik Hatcher                                                  
             <erik@ehatchersol                                             
             utions.com>                                                 A 
                                       java-dev@lucene.apache.org          
             05/12/2005 23:43                                           cc 
                                                                           
                                                                     Objet 
             Veuillez répondre         Re: renaming IndexReader.delete() ? 
                     à                                                     
             java-dev@lucene.a                                             
                 pache.org                                                 
                                                                           
                                                                           
                                                                           






On Dec 5, 2005, at 3:04 PM, Andi Vajda wrote:
> 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)


+1

I volunteer to make this change if it is agreed upon.  I have a
vested interest in seeing GCJ work as well as possible :)

             Erik


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




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


Re: renaming IndexReader.delete() ?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Dec 5, 2005, at 3:04 PM, Andi Vajda wrote:
> 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)


+1

I volunteer to make this change if it is agreed upon.  I have a  
vested interest in seeing GCJ work as well as possible :)

	Erik


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