lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giulio Cesare Solaroli <>
Subject Re: deleting with an open writer.
Date Mon, 08 Nov 2004 06:02:30 GMT
Hi Chris,

we had the same problem and we have "fixed" it changing our indexing procedure.

The basic idea is to have a stored/not tokenized/indexed unique
primary key for each document (let's call it simply ID, even if it not
the docID managed by lucene itself).
With this ID, you can insert all you new documents into the index;
this may cause some duplicated (according to you ID) but lucene won't

After adding all you new/updated documents (and having your index
writer close), you can use the list of the just indexed documents to
search on the lucene index if any of the new inserted IDs match with
multiple documents; this later condition should happen only when a
document have been re-inserted having been updated.

If any of the ID has multiple match, you can delete the old versions
of the document on the lucene index. You can find out the old versions
comparing the lucene docID of the matching documents, being the latest
version the one with the greatest docID.

Hope this helps.

Giulio Cesare Solaroli

On Sun, 7 Nov 2004 20:36:55 -0800, Chris Fraschetti
<> wrote:
> part of my indexing process is determining if an older instance of the
> current document bring indexed exists.. and if it does, delete it.
> which required me to have an IndexWriter open .. and then an
> IndexReader... when I call the delete of a document, I of course get
> an io exception caused by the lucene lock.
> Is there any way around this? I've tried to simply close the writer,
> delete, and then reopen, but that seems to not have much of an affect.
> anyone have any luck with deleting and writing at the same time?
> --
> ___________________________________________________
> Chris Fraschetti
> e
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message