Re: ReadOnly IndexReaders

2009-06-04 Thread Shai Erera
So for this scenario I guess I would have like to know the reader is read-only. But if I understand you correctly, you say that writing my app such that one method get a reader for doing some job on non-deleted documents, while another get the same reader and might delete stuff is a bad design anyw

Re: ReadOnly IndexReaders

2009-06-04 Thread Yonik Seeley
On Thu, Jun 4, 2009 at 10:19 AM, Mark Miller wrote: > If you use hasDeletions() with a non read-only > Reader, then someone could delete out from under you, right? Right... but calling isDeleted() doesn't fix that (because of race conditions). You could call isDeleted(5) which would return false

Re: ReadOnly IndexReaders

2009-06-04 Thread Mark Miller
Yonik Seeley wrote: On Thu, Jun 4, 2009 at 9:37 AM, Mark Miller wrote: I was thinking you have a read-only snapshot to check on the deletes though. Another thread can't do a delete with that Reader, and if they are doing it on another Reader, it wouldn't affect the snapshot the read-only Rea

Re: ReadOnly IndexReaders

2009-06-04 Thread Yonik Seeley
On Thu, Jun 4, 2009 at 9:37 AM, Mark Miller wrote: > I was thinking you have a read-only snapshot to check on the deletes though. > Another thread > can't do a delete with that Reader, and if they are doing it on another > Reader, it wouldn't > affect the snapshot the read-only Reader had opened?

Re: ReadOnly IndexReaders

2009-06-04 Thread Mark Miller
Yonik Seeley wrote: On Tue, Jun 2, 2009 at 4:54 AM, Shai Erera wrote: You could call reader.hasDeletions to decide whether you should call isdeleted()? But you cannot use that alone, since if a library receives an IndexReader, it cannot rely solely on hasDeletions, since at an upper level so

Re: ReadOnly IndexReaders

2009-06-04 Thread Yonik Seeley
On Tue, Jun 2, 2009 at 4:54 AM, Shai Erera wrote: > You could call reader.hasDeletions to decide whether you should call > isdeleted()? But you cannot use that alone, since if a library receives an > IndexReader, it cannot rely solely on hasDeletions, since at an upper level > someone might decide

Re: ReadOnly IndexReaders

2009-06-02 Thread Mark Miller
Good point Shai. A mix of hasDeletes and is isReadOnly does appear to be useful then. - Mark Shai Erera wrote: You could call reader.hasDeletions to decide whether you should call isdeleted()? But you cannot use that alone, since if a library receives an IndexReader, it cannot rely solely on

Re: ReadOnly IndexReaders

2009-06-02 Thread Shai Erera
You could call reader.hasDeletions to decide whether you should call isdeleted()? But you cannot use that alone, since if a library receives an IndexReader, it cannot rely solely on hasDeletions, since at an upper level someone might decide to delete a document w/ that reader, and therefore it need

Re: ReadOnly IndexReaders

2009-06-01 Thread Jason Rutherglen
Currently there's ReadOnlyMultiSegmentReader and ReadOnlySegmentReader, which calling instanceof on an IndexReader is a current hacked package protected way of finding out if a reader is read only. I wrote code before which checked by calling instanceof on both, which seemed a bit strange. On Sat

Re: ReadOnly IndexReaders

2009-06-01 Thread Mark Miller
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

Re: ReadOnly IndexReaders

2009-06-01 Thread Grant Ingersoll
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-unsubscr...@lucene.apache.org For ad

Re: ReadOnly IndexReaders

2009-06-01 Thread Grant Ingersoll
On Jun 1, 2009, at 5:40 AM, Yonik Seeley wrote: On May 30, 2009, at 13:27, Mark Miller 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 th

Re: ReadOnly IndexReaders

2009-06-01 Thread Mark Miller
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.

Re: ReadOnly IndexReaders

2009-06-01 Thread Yonik Seeley
> On May 30, 2009, at 13:27, Mark Miller 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 > isDe

Re: ReadOnly IndexReaders

2009-06-01 Thread Grant Ingersoll
On May 30, 2009, at 13:27, Mark Miller 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

Re: ReadOnly IndexReaders

2009-05-30 Thread Simon Willnauer
+1 On May 29, 2009 11:27 PM, "Jason Rutherglen" wrote: Yeah! On Fri, May 29, 2009 at 2:21 PM, Grant Ingersoll wrote: > > Does it make sen...

Re: ReadOnly IndexReaders

2009-05-30 Thread Yonik Seeley
On Sat, May 30, 2009 at 1:27 PM, Mark Miller wrote: > Is there a valid use case? That was my question too... I really can't think of one. Maybe we should leave it out until there is actually a need for it. -Yonik http://www.lucidimagination.com --

Re: ReadOnly IndexReaders

2009-05-30 Thread Mark Miller
Is there a valid use case? It seems like it might be a tricky method, because its an IndexReader property and not the index. 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 sy

Re: ReadOnly IndexReaders

2009-05-30 Thread Grant Ingersoll
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 wrote: Does it make sense to add isReadOnly() to IndexReader such that one can easily introspect whether a Reader is read only? -Grant

Re: ReadOnly IndexReaders

2009-05-30 Thread Michael McCandless
Makes sense! Mike On Fri, May 29, 2009 at 5:21 PM, Grant Ingersoll wrote: > Does it make sense to add isReadOnly() to IndexReader such that one can > easily introspect whether a Reader is read only? > > -Grant > > - > To unsubsc

RE: ReadOnly IndexReaders

2009-05-30 Thread Uwe Schindler
, 2009 11:21 PM > To: java-dev@lucene.apache.org > Subject: ReadOnly IndexReaders > > Does it make sense to add isReadOnly() to IndexReader such that one > can easily introspect whether a Reader is read only? > > -Grant > > --

Re: ReadOnly IndexReaders

2009-05-29 Thread Jason Rutherglen
Yeah! On Fri, May 29, 2009 at 2:21 PM, Grant Ingersoll 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:

ReadOnly IndexReaders

2009-05-29 Thread Grant Ingersoll
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-unsubscr...@lucene.apache.org For additional commands, e-mail: