You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Albert Vila Puig <av...@imente.com> on 2004/01/12 12:16:45 UTC

Lucene's delete feature

Hi all,

    I want to maintain an index only with the last month documents. I am 
adding all documents sorted by date, in order to use the 
IndexOrderSearcher and sort the results by date.
    My problem begins went I want to delete documents from the last 
month index. Can I delete and add documents from the index and preserve 
the document numbers?
   
    For example, my idea is at the end of each day, delete the first day 
from the index, and add the today's documents to it.

Thanks,

Sorry for my poor english.

-- 
Albert Vila Puig
http://www.imente.com
[iMente, El mayor agregador de titulares en español]
Le invitamos a visitar nuestra nueva web y probar nuestros servicios



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


Re: Lucene's delete feature

Posted by Doug Cutting <cu...@apache.org>.
Albert Vila Puig wrote:
>      For example, my idea is at the end of each day, delete the first 
> day from the index, and add the today's documents to it.

That should work fine.  Newly added documents always have numbers 
greater than all documents in the index.  As deleted documents are 
reclaimed document numbers shift downwards, but documents added earlier 
always retain smaller numbers than those added later.

Doug


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


RE: Lucene's delete feature

Posted by Jamie Stallwood <ju...@project76.co.uk>.
Hello Albert,

I think you might find this message from Doug Cutting useful.

Jamie


Tate Avery wrote:
> ...I need to know which Lucene operations can cause document ids to
change.
>
> I am assuming that the following can cause potential changes:
> 	1) Add document
> 	2) Optimize index
>
> What else could cause a document id to change?

Nothing.  And even these can only cause an id to change if there have
been deletions.

> Could delete provoke a doc id change?

Not when you perform the delete.  Later, when you add to or optimize the
index, the ids for deleted documents are reclaimed.

> And, I am assuming that the following DO NOT change the document id:
>
> 	1) Query the index

That is correct.

Document ids never change with an instance of IndexReader.  When you
open a new index reader you should usually assume that ids have changed.

Doug


-----Original Message-----
From: Albert Vila Puig [mailto:avp@imente.com]
Sent: 12 January 2004 11:17
To: lucene-dev@jakarta.apache.org
Subject: Lucene's delete feature

Hi all,

    I want to maintain an index only with the last month documents. I am
adding all documents sorted by date, in order to use the
IndexOrderSearcher and sort the results by date.
    My problem begins went I want to delete documents from the last
month index. Can I delete and add documents from the index and preserve
the document numbers?

    For example, my idea is at the end of each day, delete the first day
from the index, and add the today's documents to it.

Thanks,

Sorry for my poor english.

--
Albert Vila Puig
http://www.imente.com
[iMente, El mayor agregador de titulares en español]
Le invitamos a visitar nuestra nueva web y probar nuestros servicios



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




--
Visit us at http://www.project76.co.uk
THE SITE for Little Britain!


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