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 Max Pfingsthorn <m....@hippo.nl> on 2005/06/03 18:50:12 UTC

deleting on a keyword field

Hi!

I'm trying to delete a document from the index. Somehow it doesn't work. I made a Field.Keyword out of my document's URI and would now like to delete a document with a certain uri like so:

reader.delete(new Term(URI_FIELD, uri));

This does not remove anything. Do I have to make the uri a normal field?

Thanks for your help in advance!

Best regards,

Max Pfingsthorn

Hippo  

Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
m.pfingsthorn@hippo.nl / www.hippo.nl
--------------------------------------------------------------

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


Re: deleting on a keyword field

Posted by Ernesto De Santis <er...@colaborativa.net>.
from javadoc:

public final int *delete*(Term <ci...@colaborativa.net> term)
                 throws IOException <http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html>

Deletes all documents containing |term|. This is useful if one uses a 
document field to hold a unique ID string for the document. Then to 
delete such a document, one merely constructs a term with the 
appropriate field and the unique ID string as its text and passes it to 
this method.* Returns the number of documents deleted.*

bye
Ernesto.


Daniel Naber escribió:

>On Friday 03 June 2005 18:50, Max Pfingsthorn wrote:
>
>  
>
>>reader.delete(new Term(URI_FIELD, uri));
>>
>>This does not remove anything. Do I have to make the uri a normal field?
>>    
>>
>
>How do you know nothing was deleted? Are you aware that you need to re-open 
>your IndexSearcher/Reader in order to see the changes made to the index?
>
>Regards
> Daniel
>
>  
>

-- 
Ernesto De Santis - Colaborativa.net
La Plata, Argentina.
http://www.colaborativa.net/


		
___________________________________ 
A tu celular ¿no le falta algo? 
Usá Yahoo! Messenger y Correo Yahoo! en tu teléfono celular. 
Más información en http://movil.yahoo.com.ar

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


Re: deleting on a keyword field

Posted by Daniel Naber <lu...@danielnaber.de>.
On Friday 03 June 2005 18:50, Max Pfingsthorn wrote:

> reader.delete(new Term(URI_FIELD, uri));
>
> This does not remove anything. Do I have to make the uri a normal field?

How do you know nothing was deleted? Are you aware that you need to re-open 
your IndexSearcher/Reader in order to see the changes made to the index?

Regards
 Daniel

-- 
http://www.danielnaber.de

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


Re: deleting on a keyword field

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jun 3, 2005, at 12:50 PM, Max Pfingsthorn wrote:

> Hi!
>
> I'm trying to delete a document from the index. Somehow it doesn't  
> work. I made a Field.Keyword out of my document's URI and would now  
> like to delete a document with a certain uri like so:
>
> reader.delete(new Term(URI_FIELD, uri));
>
> This does not remove anything. Do I have to make the uri a normal  
> field?

Try a search using a TermQuery for that Term - are the document(s)  
you expect to be deleted found?  If not, then you'll have to research  
how you indexed to ensure the keyword

     Erik