Hmm... for step 4 you should have gotten "true" back from isCurrent.
You're sure there were no intervening calls to IndexWriter.commit?
Are you using Lucene 2.9?   If not, you have to make sure autoCommit
is false when opening the IndexWriter.

Mike

On Fri, Nov 6, 2009 at 2:46 PM, Peter Keegan <peterlkee...@gmail.com> wrote:
> Here's a new scenario:
>
> 1. JVM 1 creates IndexWriter, version 1
> 2. JVM 2 creates IndexReader, version 1
> 3. JVM 1 IndexWriter calls prepareCommit()
> 4. JVM 2 IndexReader.isCurrent() returns false
>
> In step 4, I expected 'isCurrent' to return true until the IndexWriter had
> committed in JVM 1. Is this the correct behavior?
>
> Peter
>
>
> On Fri, Nov 6, 2009 at 11:40 AM, Michael McCandless <
> luc...@mikemccandless.com> wrote:
>
>> It will always return a reader reflecting every change done with that
>> writer (plus, the index as it was when the writer was opened) before
>> getReader was called.
>>
>> It's unaffected by the call to prepareCommit.
>>
>> Mike
>>
>> On Fri, Nov 6, 2009 at 11:35 AM, Peter Keegan <peterlkee...@gmail.com>
>> wrote:
>> > Which version of the index will IndexWriter.getReader() return if there
>> have
>> > been updates, but no call to 'prepareCommit'?
>> >
>> >
>> > On Fri, Nov 6, 2009 at 11:33 AM, Michael McCandless <
>> > luc...@mikemccandless.com> wrote:
>> >
>> >> On Fri, Nov 6, 2009 at 11:22 AM, Peter Keegan <peterlkee...@gmail.com>
>> >> wrote:
>> >> >>Can you use IndexWriter.getReader() to get the reader for step 2
>> >> > Yes - perfect! I didn't think that would be different than refreshing
>> or
>> >> > recreating an IndexReader.
>> >>
>> >> Great!
>> >>
>> >> getReader() searches the full index, plus uncommitted changes.
>> >>
>> >> > I don't need to keep the old commit alive. The goal is to keep the
>> >> external
>> >> > file in synch with the index, so a separate searcher process will see
>> >> > consistent data. By postponing both commits, the window where they are
>> >> out
>> >> > of synch is very small (2 file renames). I record the Lucene index
>> >> version
>> >> > in the external file for checking synchcronization.
>> >>
>> >> OK.
>> >>
>> >> Mike
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
>> >> For additional commands, e-mail: java-user-h...@lucene.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
>> For additional commands, e-mail: java-user-h...@lucene.apache.org
>>
>>
>

---------------------------------------------------------------------
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