lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Bowesman <...@teamware.com>
Subject Re: Does Lucene search over memory too?
Date Tue, 29 May 2007 10:20:06 GMT
Doron Cohen wrote:
> Antony Bowesman <adb@teamware.com> wrote on 28/05/2007 22:48:41:
> 
>> I read the new IndexWriter Javadoc and I'm unclear about this
>> autocommit.  In
>> 2.1, I thought an IndexReader opened in an IndexSearcher does not "see"
>> additions to an index made by an IndexWriter, i.e. maxDoc and
>> numDocs remain
>> constant, so the statement
>>
>> "When autoCommit is true then every flush is also a commit (IndexReader
>> instances will see each flush as changes to the index). This is
>> the default, to
>> match the behavior before 2.2"
>>
>> makes me wonder if my assumptions are wrong.  Can you clarify
>> what it means by
>> the IndexReader "seeing" changes to the index?
> 
> Antony, your assumptions were (and still are) correct - once
> an index reader is opened it is unaffected by changes to the
> underlying index. Would it be clearer if the javadoc said:
> "(An IndexReader instance will see changes to the index caused
> by flush operations that completed prior to opening that
> IndexReader instance)."?

Thanks Doron, I understood "IndexReader instance" as one that was already open, 
as it's not possible to 'open' an existing object instance, the static open() 
methods create new instances.

Your explanation clarifies things.  So, the scenario where the IndexReader sees 
changes with autocommit=true is

BEGIN
IndexWriter - open
- add documents
   - some merges/flushes occur here
   IndexReader - open
   - sees index with results of earlier merges
IndexWriter - close
END

whereas with autocommit=false, the IndexReader would see the state of the index 
at BEGIN and any merges/flushes would not show.

Perhaps the text could then be something like

"(Changes to the index caused by flush operations will be visible to an 
IndexReader when it is opened prior to closing the IndexWriter)"

It would also be worth updating the isCurrent() Javadoc to clarify its 
behaviour.  Presumably, with autocommit=false, isCurrent() will always return 
true is only using the IndexWriter to add/delete documents.

Antony



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


Mime
View raw message