Mike,

> needing a fast way to swap in your own deleted docs?

Yes, however it is necessary to have a new IndexReader as well from a
"reopened" reader.  So clone seems the best approach (unless there's a way
I'm not seeing).  The clone
code is coming along, the norms test seems to pass.  As long as similar
rules as reopen are followed such as from the javadoc "The re-opened reader
instance and the old instance might share the same resources. For this
reason no index modification operations (e. g.
deleteDocument(int)<http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc//org/apache/lucene/index/IndexReader.html#deleteDocument%28int%29>,
setNorm(int, String,
byte)<http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc//org/apache/lucene/index/IndexReader.html#setNorm%28int,%20java.lang.String,%20byte%29>)
should be performed using one of the readers until the old reader instance
is closed. *Otherwise, the behavior of the readers is undefined.*".

I think the clone method javadoc should read "After cloning a reader, the
original reader will throw exceptions on index modification operations (e.
g. 
deleteDocument(int)<http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc//org/apache/lucene/index/IndexReader.html#deleteDocument%28int%29>,
setNorm(int, String,
byte)<http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc//org/apache/lucene/index/IndexReader.html#setNorm%28int,%20java.lang.String,%20byte%29>)".
This way one may read from the original, but the cloned reader (new reader)
may accept updates.  This happens by way to automatically releasing a lock
on clone (does this cause any unforseen problems?).

Jason

On Tue, Dec 16, 2008 at 7:00 AM, Michael McCandless <
luc...@mikemccandless.com> wrote:

>
> Jason,
>
> Is your need for IndexReader.clone entirely driven by needing a fast way to
> swap in your own deleted docs?
>
> Meaning, if you could plug in your own deleted docs to a reader (somehow),
> would you not use clone anymore?
>
> Mike
>
>
> Jason Rutherglen wrote:
>
>  Hello,
>>
>> In trying to figure out the best way to have a system for realtime whereby
>> the deletedDocs do not need to be saved there are two possible methods,
>> 1) setting the DocIdBitSet manually (which breaks the saving and things,
>> but does not require doing norms cloning), or 2) implementing
>> IndexReader.clone
>> which requires deletedDocs and norms "copy on write".
>>
>> The discussion about reopen (
>> https://issues.apache.org/jira/browse/LUCENE-743)
>> was lengthy and I can see from the code and the discussion why no one
>> wants to
>> revisit IndexReader.reopen in the form of IndexReader.clone and possibly
>> mess things up.
>>
>> Is some alternative easier API possible that I'm missing?
>>
>> -J
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-dev-h...@lucene.apache.org
>
>

Reply via email to