lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Smith <ssm...@mainstreamdata.com>
Subject RE: Lucene 4.0 delete by ID
Date Mon, 29 Oct 2012 20:19:37 GMT
I understand the issue of the lucene doc id changing.  I'll probably look to see if I can delete
stuff just based on some field that I have that I know won't change.  I've used the doc id
for a long time, but maybe it's time for a change.  

Thanks for all of the input.

Scott

-----Original Message-----
From: martijn.is.hier@gmail.com [mailto:martijn.is.hier@gmail.com] On Behalf Of Martijn v
Groningen
Sent: Sunday, October 28, 2012 3:24 PM
To: java-user@lucene.apache.org
Subject: Re: Lucene 4.0 delete by ID

A top level document ID can change over time. For that reason you shouldn't rely on it. However
if you know your index is stable or you keep track when a merge happes, you can use the IndexWriter#tryDeleteDocument
method to delete a document by Lucene id. Deleting a document via a IndexReader is no longer
possible.

Martijn

On 27 October 2012 01:47, Mossaab Bagdouri <bagdouri_mossaab@yahoo.fr> wrote:
> Lucene document IDs are not stable. You could add a field with an ID 
> that you maintain. Your query would then be just a TermQuery on the ID.
>
> Regards,
> Mossaab
>
>
> 2012/10/26 Scott Smith <ssmith@mainstreamdata.com>
>
>> I'm currently converting some lucene code to 4.0.  It appears that 
>> you are no longer allowed to delete a document by its ID.  Is that 
>> correct?  Is my only option to figure some kind of query (which 
>> obviously isn't based on
>> ID) and do the delete from there?
>>



--
Met vriendelijke groet,

Martijn van Groningen

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


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

Mime
View raw message