Hi Wojtek,

Thank you for linking to your test code!

When you open an IndexReader, it is locked to the view of the Lucene
directory at the time that it's opened.

If you make changes, you'll need to open a new IndexReader before those
changes are visible. I see that you tried creating a new IndexSearcher, but
unfortunately that's not sufficient.

Hope that helps!
Froh

On Fri, Aug 9, 2024 at 3:25 PM Wojtek <woj...@unir.se> wrote:

> Hi all!
>
> There is an effort in Apache James to update to a more modern version of
> Lucene (ref:
> https://github.com/apache/james-project/pull/2342). I'm digging into the
> issue as other have done
> but I'm stumped - it seems that
> `org.apache.lucene.index.IndexWriter#updateDocument` doesn't update
> the document.
>
> Documentation
> (
> https://lucene.apache.org/core/9_10_0/core/org/apache/lucene/index/IndexWriter.html#updateDocument(org.apache.lucene.index.Term,java.lang.Iterable))
>
> states:
>
>  > Updates a document by first deleting the document(s) containing term
> and then adding the new
> document. The delete and then add are atomic as seen by a reader on the
> same index (flush may happen
> only after the add).
>
> Here is a simple test with it:
>
> https://github.com/woj-tek/lucene-update-test/blob/master/src/test/java/se/unir/AppTest.java
>
> but it fails.
>
> Any guidance would be appreciated because I (and others) have been hitting
> wall with it :)
>
> --
> Wojtek
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>

Reply via email to