lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christiaan Fluit <Christiaan.Fl...@aduna.biz>
Subject Re: Deleting a document with an IndexWriter open
Date Fri, 16 Jul 2004 08:00:08 GMT
Giulio Cesare Solaroli wrote:
> is there any architectural reason while an IndexWriter could not
> delete a document?

[snip]

> In this situation, I try to keep the same IndexWriter open as much as
> possible, in order to avoid any unnecessary fragmentation of the
> index.
> Before indexing any document, I can check to see if the document has
> already been inserted, but I am not able to delete it without closing
> the IndexWriter, opening an IndexReader, deleting the document,
> closing the IndexReader an opening again the IndexWritere.

That's exactly what we do. It's not optimal but it works.

My guess would be that the chosen architecture makes it possible to 
query the index while it is simultaneously being updated. I believe 
(correct me if I'm wrong) that you can add documents to an index and 
query it at the same time. Only the IndexReader won't see the new 
documents that have been added after it has been created. I can imagine 
that this is much harder to realize when IndexWriter can not only add 
documents but also delete them.

Can any of the Lucene designers tell me why you chose to create an 
IndexWriter and an IndexReader class instead of a single Index class 
that handles all these aspects for you? It seems to me that this way you 
could have solved a lot of these issues internally in Lucene, instead of 
leaving it up to the integrator.


Kind regards,

Chris
--


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


Mime
View raw message