You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Grant Ingersoll <gs...@apache.org> on 2009/06/01 14:26:57 UTC

Re: ReadOnly IndexReaders




On May 30, 2009, at 13:27, Mark Miller <ma...@gmail.com> wrote:

> Is there a valid use case? It seems like it might be a tricky  
> method, because its an IndexReader property and not the index.

But it's just a flag passed in

If you know it's read only and that there are no deletes, can't you  
avoid isDeleted all together?

I'm mostly thinking it's useful for libraries that take in a Reader.


> A user should probably technically treat read-only/non-read-only the  
> same because it does not imply a different IndexReader didn't make  
> changes/do deletes?
>
> It doesn't sync deletes, but should you use the API any differently?
>
> I don't see it hurting anything of course, but is there a real use  
> case?
>
> Grant Ingersoll wrote:
>> OK, I'll do it.
>>
>> On May 30, 2009, at 8:29 AM, Michael McCandless wrote:
>>
>>> Makes sense!
>>>
>>> Mike
>>>
>>> On Fri, May 29, 2009 at 5:21 PM, Grant Ingersoll <gsingers@apache.org 
>>> > wrote:
>>>> Does it make sense to add isReadOnly() to IndexReader such that  
>>>> one can
>>>> easily introspect whether a Reader is read only?
>>>>
>>>> -Grant
>>>>
>>>> --- 
>>>> ------------------------------------------------------------------
>>>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>>>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>>>
>>>>
>>>
>>> --- 
>>> ------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>
>
>
> -- 
> - Mark
>
> http://www.lucidimagination.com
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>

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


Re: ReadOnly IndexReaders

Posted by Mark Miller <ma...@gmail.com>.
But it doesn't help the library. It can't assume there are no deletes just
because the reader is read only. And if you know you don't do deletes you
can skip calling isdeleted readonly or not. The only way this works cleanly
is if you could ask if the "index" is readonly, not the Reader. Knowing a
Reader is read-only does not help a generic Lucene library from calling
isDeleted - it still must be called in a generic library - only the specific
app would know it could be skipped, because it would know the "index" is
read-only, not just the transient Reader.

On Mon, Jun 1, 2009 at 5:58 PM, Grant Ingersoll <gs...@apache.org> wrote:

>
> On Jun 1, 2009, at 8:48 AM, Mark Miller wrote:
>
>  Right. The app will know if the index is readonly.
>>
>
> Yes, but a library that was passed the reader may not.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

Re: ReadOnly IndexReaders

Posted by Grant Ingersoll <gs...@apache.org>.
On Jun 1, 2009, at 8:48 AM, Mark Miller wrote:

> Right. The app will know if the index is readonly.

Yes, but a library that was passed the reader may not.

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


Re: ReadOnly IndexReaders

Posted by Mark Miller <ma...@gmail.com>.
Right. The app will know if the index is readonly. isReadonly would  
only tell you the reader was readonly, not the index. A readonly  
reader can be opened on an index with deletes. That why it's tricky.  
It's not useful for what you might think you would use it for. At  
least pure API wise.

- Mark

http://www.lucidimagination.com (mobile)

On Jun 1, 2009, at 8:40 AM, Yonik Seeley <yo...@lucidimagination.com>  
wrote:

>> On May 30, 2009, at 13:27, Mark Miller <ma...@gmail.com> wrote:
>>> Is there a valid use case? It seems like it might be a tricky  
>>> method,
>>> because its an IndexReader property and not the index.
>>
>> But it's just a flag passed in
>>
>> If you know it's read only and that there are no deletes, can't you  
>> avoid
>> isDeleted all together?
>
> If you know there are no deletes, you should be able to avoid calling
> isDeleted anyway.
>
> -Yonik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>

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


Re: ReadOnly IndexReaders

Posted by Grant Ingersoll <gs...@apache.org>.
On Jun 1, 2009, at 5:40 AM, Yonik Seeley wrote:

>> On May 30, 2009, at 13:27, Mark Miller <ma...@gmail.com> wrote:
>>> Is there a valid use case? It seems like it might be a tricky  
>>> method,
>>> because its an IndexReader property and not the index.
>>
>> But it's just a flag passed in
>>
>> If you know it's read only and that there are no deletes, can't you  
>> avoid
>> isDeleted all together?
>
> If you know there are no deletes, you should be able to avoid calling
> isDeleted anyway.

But someone could call delete on the reader if it isn't read-only.   
The case I have is I'm writing a library that takes in an IndexReader  
and then I'm going to be iterating over the documents.  My thinking,  
and it may be faulty, is that if I know there are no deletes and the  
IR is read-only, I can eliminate the isDeleted() check.  Not likely a  
big deal until we're talking lots and lots of docs.

-Grant

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


Re: ReadOnly IndexReaders

Posted by Yonik Seeley <yo...@lucidimagination.com>.
> On May 30, 2009, at 13:27, Mark Miller <ma...@gmail.com> wrote:
>> Is there a valid use case? It seems like it might be a tricky method,
>> because its an IndexReader property and not the index.
>
> But it's just a flag passed in
>
> If you know it's read only and that there are no deletes, can't you avoid
> isDeleted all together?

If you know there are no deletes, you should be able to avoid calling
isDeleted anyway.

-Yonik

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