You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by petite_abeille <pe...@mac.com> on 2003/08/26 21:37:47 UTC

IndexReader.delete(Term)?

Hello,

This is more a sanity check, than anything else, but...

I'm trying to delete a document using IndexReader.delete(Term)... (for 
the record I'm using 1.3-rc1)

The document was created with a Field.Keyword() to uniquely identify it.

The document exists, was saved, can be queried, life is good :)

But then... when trying to delete the same document later on... 
IndexReader.delete(Term) returns 0 and the document doesn't get 
deleted... which is driving me crazy 8}

Here is what I'm doing to delete the document:

     Term	aTerm = new Term( aKey, anID );

     aReader.delete( aTerm );
     aReader.close();

The term looks like the following:

szid:3FA7168800F7FDE8ECAA35500A00012D

But this doesn't seem to do anything... The document is still there no 
matter what...

I'm sure I'm doing something very wrong, but for the life of me I 
cannot see what... anything obvious I'm missing?

Thanks.

Cheers,

PA.


Re: IndexReader.delete(Term)?

Posted by Erik Hatcher <li...@ehatchersolutions.com>.
What you are doing looks fine to me.  I'm sure these are obvious 
questions, kinda like "is your computer plugged in?", but here goes:

- How are you determining that the document is still there?  With an 
IndexReader?  IndexSearcher?
- A freshly created (i.e. after the delete) Index[Searcher|Reader]?
- And finally, did you remember to recompile?!  :))  (just kidding)



On Tuesday, August 26, 2003, at 03:37  PM, petite_abeille wrote:

> Hello,
>
> This is more a sanity check, than anything else, but...
>
> I'm trying to delete a document using IndexReader.delete(Term)... (for 
> the record I'm using 1.3-rc1)
>
> The document was created with a Field.Keyword() to uniquely identify 
> it.
>
> The document exists, was saved, can be queried, life is good :)
>
> But then... when trying to delete the same document later on... 
> IndexReader.delete(Term) returns 0 and the document doesn't get 
> deleted... which is driving me crazy 8}
>
> Here is what I'm doing to delete the document:
>
>     Term	aTerm = new Term( aKey, anID );
>
>     aReader.delete( aTerm );
>     aReader.close();
>
> The term looks like the following:
>
> szid:3FA7168800F7FDE8ECAA35500A00012D
>
> But this doesn't seem to do anything... The document is still there no 
> matter what...
>
> I'm sure I'm doing something very wrong, but for the life of me I 
> cannot see what... anything obvious I'm missing?
>
> Thanks.
>
> Cheers,
>
> PA.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>