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 (JIRA)" <ji...@apache.org> on 2010/10/09 16:29:30 UTC

[jira] Created: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Consolidate Near Real Time and Reopen API semantics
---------------------------------------------------

                 Key: LUCENE-2691
                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
             Project: Lucene - Java
          Issue Type: Improvement
            Reporter: Grant Ingersoll
            Priority: Minor
             Fix For: 3.1, 4.0


We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
{code}
IR.reopen(IndexWriter)
{code}

Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919503#action_12919503 ] 

Michael McCandless commented on LUCENE-2691:
--------------------------------------------

bq. What's with all of the test dependencies on IndexWriter.getReader() that seemingly don't have anything to do with NRT? For instance, TestQueryParser.testPositionIncrements() or TestCachingSpanFilter?

This is just because those tests need a reader having just built the index... ie, as long as there's no other reason to .commit, getting the reader from the writer is perfectly fine.

Plus this only increases test coverage of NRT.

RandomIndexWriter's .getReader method now randomly picks to either get the reader from the writer, or, to .commit and then open a new reader.

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919568#action_12919568 ] 

Simon Willnauer commented on LUCENE-2691:
-----------------------------------------

bq. Should be good to go, but may need a few doc improvements.

I think docs are fine though at least what I read on IR but I wonder why we need to synchronize on the iIR here since this call only forwards to the given writer? 
{code}
 public synchronized IndexReader reopen(IndexWriter writer) throws CorruptIndexException, IOException {
   return writer.getReader();
 }
{code}

I would guess calling writer.getReader() in there should not block other actions like concurrent searches on this reader since a NRT getRearder call can take its time. If at all we should sync on the writer though (which is already done inside IW) or do I miss something?

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920583#action_12920583 ] 

Grant Ingersoll commented on LUCENE-2691:
-----------------------------------------

bq. The method you introduced makes it perfectly fine to open a reader on some directory, and then try reopening it on IW, and then on another IW. Later you're going to add a heap of guards on this method, and runtime exceptions if user does some pointless reopen sequence?

I don't see that.  All we did was move the call from IW to IR where the reopen method was already located.  Nothing is preventing a user from doing exactly what you described above with the old way either.

bq. What was wrong with old parameterless reopen() call?

Nothing.  That's why it is still there.  This is about user comprehension and usability of the API, not about some functionality.  Having trained hundreds of people on this, it's confusing to people (just like it's confusing that a "Reader" can do deletes).  Why would a Writer object give me a Reader?  Why would a Reader do write functionality?  

bq. if you got a reader from IW, it reopens by asking said IW for the segments.

Yep, and if you (re)open a Reader with an IW you get a Reader based on those segments.

bq. Adding more ways to do the same thing in this case just seems to complicate the API. 

We didn't add any more ways to do this.  The exact same number of ways exist now.  All we've done is kept Reader semantics on the Reader and Writer semantics on the Writer.  

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Earwin Burrfoot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920601#action_12920601 ] 

Earwin Burrfoot commented on LUCENE-2691:
-----------------------------------------

bq. As I said above, though, I'm fine w/ dropping the reopen one and just keeping open(IW). 
Let's do this.

In my ideal world the semantics of each method is encoded in its name.
So 'open' - always gets you a brand new reader on a given target, while 'reopen' updates the one you have.
Due to snapshot nature of readers, you don't do update inplace and get a new instance instead, but that doesn't make these two methods' semantics the same.

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920593#action_12920593 ] 

Grant Ingersoll commented on LUCENE-2691:
-----------------------------------------

Again, how is that any different?  You are getting back a new Reader and assigning it to the same variable name.  
{code}
Directory d = Directory.open("/path/to/somewhere"); // Nice
IndexReader r = IndexReader.open(d); // Nice

Directory d2 = new RAMDirectory(); // Okay
IndexWriter w = new IndexWriter(d2); // Sure

r = writer.getReader() // WTF Indeed!
{code}



> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grant Ingersoll resolved LUCENE-2691.
-------------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 3.1)

Committed revision 1006280.

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Reopened: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reopened LUCENE-2691:
----------------------------------------


Reopen until we settle the API question...

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Earwin Burrfoot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920565#action_12920565 ] 

Earwin Burrfoot commented on LUCENE-2691:
-----------------------------------------

What's up with intentionally twisted APIs?

The method you introduced makes it perfectly fine to open a reader on some directory, and then try reopening it on IW, and then on another IW. Later you're going to add a heap of guards on this method, and runtime exceptions if user does some pointless reopen sequence?

What was wrong with old parameterless reopen() call?
If you've got a reader over Directory, it reopens looking for new segments there, if you got a reader from IW, it reopens by asking said IW for the segments.

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919498#action_12919498 ] 

Michael McCandless commented on LUCENE-2691:
--------------------------------------------

+1!

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920581#action_12920581 ] 

Yonik Seeley commented on LUCENE-2691:
--------------------------------------

I think I agree Earwin... it's not clear what functionality was added with this patch, just a vague notion of consolidating semantics.  Adding more ways to do the same thing in this case just seems to complicate the API.

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919504#action_12919504 ] 

Michael McCandless commented on LUCENE-2691:
--------------------------------------------

bq. we'll have to add an IndexReader.open(IndexWriter) method (plus, I suppose a couple of variations). 

+1

I think IR.open(IW) makes sense.

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920586#action_12920586 ] 

Grant Ingersoll commented on LUCENE-2691:
-----------------------------------------

I guess, however, to assuage you guys, perhaps we could drop the reopen(IW) all together and just have IR.open(IW).  That satisfies my semantic/explanation need.  Although, I would suspect that over time, reopen(IW) could still make sense.

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919591#action_12919591 ] 

Grant Ingersoll commented on LUCENE-2691:
-----------------------------------------

Simon, I think you are right, as the necessary sync blocks are in the underlying getReader() call on IW.  I just copied the signatures.  I will put up a new patch.

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919620#action_12919620 ] 

Simon Willnauer commented on LUCENE-2691:
-----------------------------------------

bq. Ready to go.

+1 looks good to me

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919533#action_12919533 ] 

Michael McCandless commented on LUCENE-2691:
--------------------------------------------

patch looks great Grant!

I think we don't need the IR.open that takes a termInfosIndexDivisor... and we also don't need the IW.getReader that takes one too.  We had added these before adding IWC.set/getReaderTermsIndexDivisor...

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Issue Comment Edited: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920593#action_12920593 ] 

Grant Ingersoll edited comment on LUCENE-2691 at 10/13/10 11:04 AM:
--------------------------------------------------------------------

Again, how is that any different?  You are getting back a new Reader and assigning it to the same variable name.  
{code}
Directory d = Directory.open("/path/to/somewhere"); // Nice
IndexReader r = IndexReader.open(d); // Nice

Directory d2 = new RAMDirectory(); // Okay
IndexWriter w = new IndexWriter(d2); // Sure

r = w.getReader() // WTF Indeed!
{code}



      was (Author: gsingers):
    Again, how is that any different?  You are getting back a new Reader and assigning it to the same variable name.  
{code}
Directory d = Directory.open("/path/to/somewhere"); // Nice
IndexReader r = IndexReader.open(d); // Nice

Directory d2 = new RAMDirectory(); // Okay
IndexWriter w = new IndexWriter(d2); // Sure

r = writer.getReader() // WTF Indeed!
{code}


  
> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grant Ingersoll updated LUCENE-2691:
------------------------------------

    Attachment: LUCENE-2691.patch

Patch that makes the change.  Adds open and reopen methods to IndexReader while making it package protected on IndexWriter.

Should be good to go, but may need a few doc improvements.

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grant Ingersoll updated LUCENE-2691:
------------------------------------

    Attachment: LUCENE-2691.patch

Ready to go.

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920608#action_12920608 ] 

Grant Ingersoll commented on LUCENE-2691:
-----------------------------------------

bq. So 'open' - always gets you a brand new reader on a given target, while 'reopen' updates the one you have.

It doesn't update the one you have.  You do get a new instance and you have to properly close the old one (see http://lucene.apache.org/java/3_0_2/api/core/org/apache/lucene/index/IndexReader.html#reopen%28%29).  It is not just "updating" the internal memory of the old one, it is instead transferring that internal memory to a new instance and combining it with any changed segments.  To me, that's what the IW case feels like too.



> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920596#action_12920596 ] 

Grant Ingersoll commented on LUCENE-2691:
-----------------------------------------

The semantics of reopen is you get a new Reader.  If an optimize was done between open and reopen of the IR, you are getting an all new Reader.  Should that get rid of reopen, too?

As I said above, though, I'm fine w/ dropping the reopen one and just keeping open(IW).  I care more about the fact that it is non-intuitive to ask a Writer for a Reader and this silly notion we have right now that if you want "fast reopen" you should reopen off of the IR, but if you want "really fast reopen" you should open off the Writer.  In fact, maybe we should just drop reopen all together and simply have all points go through the open() method, by adding:  open(IndexReader)



> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919499#action_12919499 ] 

Grant Ingersoll commented on LUCENE-2691:
-----------------------------------------

What's with all of the test dependencies on IndexWriter.getReader() that seemingly don't have anything to do with NRT?  For instance, TestQueryParser.testPositionIncrements() or TestCachingSpanFilter?  

If we insist on those, then it seems we'll have to add an IndexReader.open(IndexWriter) method (plus, I suppose a couple of variations).  This concerns me b/c there are already more than enough variations on that method, but what's one more?

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Earwin Burrfoot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920592#action_12920592 ] 

Earwin Burrfoot commented on LUCENE-2691:
-----------------------------------------

Okay, let's go at it with an example.

{code}
Directory d = Directory.open("/path/to/somewhere"); // Nice
IndexReader r = IndexReader.open(d); // Nice

Directory d2 = new RAMDirectory(); // Okay
IndexWriter w = new IndexWriter(d2); // Sure

r = r.reopen(w) // WTF?!
{code}

Parameterless reopen does not allow you to "rebase" IndexReader, an overload you introduced with this patch - allows this.
I'm somewhat okay with IR.open(iw). Despite being questionable it is at least not frikkin' broken like ir.reopen(iw).

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 4.0
>
>         Attachments: LUCENE-2691.patch, LUCENE-2691.patch
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Assigned: (LUCENE-2691) Consolidate Near Real Time and Reopen API semantics

Posted by "Grant Ingersoll (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2691?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grant Ingersoll reassigned LUCENE-2691:
---------------------------------------

    Assignee: Grant Ingersoll

> Consolidate Near Real Time and Reopen API semantics
> ---------------------------------------------------
>
>                 Key: LUCENE-2691
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2691
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>
> We should consolidate the IndexWriter.getReader and the IndexReader.reopen semantics, since most people are already using the IR.reopen() method, we should simply add::
> {code}
> IR.reopen(IndexWriter)
> {code}
> Initially, it could just call the IW.getReader(), but it probably should switch to just using package private methods for sharing the internals

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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