You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Jason Rutherglen (JIRA)" <ji...@apache.org> on 2008/12/03 21:05:44 UTC

[jira] Created: (LUCENE-1475) Expose sub-IndexReaders from MultiReader or MultiSegmentReader

Expose sub-IndexReaders from MultiReader or MultiSegmentReader
--------------------------------------------------------------

                 Key: LUCENE-1475
                 URL: https://issues.apache.org/jira/browse/LUCENE-1475
             Project: Lucene - Java
          Issue Type: Improvement
            Reporter: Jason Rutherglen


MultiReader and MultiSegmentReader are package protected and do not expose the underlying sub-IndexReaders.  A way to expose the sub-readers is to have an interface that an IndexReader may be cast to that exposes the underlying readers.  

This is for realtime indexing.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1475) Expose sub-IndexReaders from MultiReader or MultiSegmentReader

Posted by "robert engels (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654518#action_12654518 ] 

robert engels commented on LUCENE-1475:
---------------------------------------

I think the API is wrong.

The method should either be

IndexReader[] getSubReaders()

It should return an empty array, not null when there are no sub readers.

But a better API is probably

IndexReader[] getReaders()

which contains an array containing itself if there are no sub-readers. The only drawback to this is if we allow multiple levels, then you need to make a check that this!=getReaders[0]

Using null adds null-checks in the common case.


> Expose sub-IndexReaders from MultiReader or MultiSegmentReader
> --------------------------------------------------------------
>
>                 Key: LUCENE-1475
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1475
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Jason Rutherglen
>            Priority: Minor
>         Attachments: LUCENE-1475.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> MultiReader and MultiSegmentReader are package protected and do not expose the underlying sub-IndexReaders.  A way to expose the sub-readers is to have an interface that an IndexReader may be cast to that exposes the underlying readers.  
> This is for realtime indexing.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Resolved: (LUCENE-1475) Expose sub-IndexReaders from MultiReader or MultiSegmentReader

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

Michael McCandless resolved LUCENE-1475.
----------------------------------------

    Resolution: Duplicate

LUCENE-1483 adds IndexReader.getSequentialReaders.

> Expose sub-IndexReaders from MultiReader or MultiSegmentReader
> --------------------------------------------------------------
>
>                 Key: LUCENE-1475
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1475
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Jason Rutherglen
>            Priority: Minor
>         Attachments: LUCENE-1475.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> MultiReader and MultiSegmentReader are package protected and do not expose the underlying sub-IndexReaders.  A way to expose the sub-readers is to have an interface that an IndexReader may be cast to that exposes the underlying readers.  
> This is for realtime indexing.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1475) Expose sub-IndexReaders from MultiReader or MultiSegmentReader

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

Jason Rutherglen updated LUCENE-1475:
-------------------------------------

           Component/s: Index
              Priority: Minor  (was: Major)
     Affects Version/s: 2.4
    Remaining Estimate: 4h
     Original Estimate: 4h

> Expose sub-IndexReaders from MultiReader or MultiSegmentReader
> --------------------------------------------------------------
>
>                 Key: LUCENE-1475
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1475
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Jason Rutherglen
>            Priority: Minor
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> MultiReader and MultiSegmentReader are package protected and do not expose the underlying sub-IndexReaders.  A way to expose the sub-readers is to have an interface that an IndexReader may be cast to that exposes the underlying readers.  
> This is for realtime indexing.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1475) Expose sub-IndexReaders from MultiReader or MultiSegmentReader

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

Michael McCandless commented on LUCENE-1475:
--------------------------------------------

I agree: a better default impl is length 1 array with yourself.

What should be returned if a Multi*Reader has embedded Multi*Readers as sub-readers?  (Admittedly rare but still... eg from the standpoint of LUCENE-831, we'd want them expanded & inlined (recursively) into the returned array, I think).

Also, this API implicitly carries a promise which is the readers are logically sequentially concatenated to define the docID sequence.  Maybe we should name it getSequentialReaders or something less generic, to reflect this?  EG ParallelReader also contains an array of sub-readers, but one should never return that in getReaders().

> Expose sub-IndexReaders from MultiReader or MultiSegmentReader
> --------------------------------------------------------------
>
>                 Key: LUCENE-1475
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1475
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Jason Rutherglen
>            Priority: Minor
>         Attachments: LUCENE-1475.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> MultiReader and MultiSegmentReader are package protected and do not expose the underlying sub-IndexReaders.  A way to expose the sub-readers is to have an interface that an IndexReader may be cast to that exposes the underlying readers.  
> This is for realtime indexing.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1475) Expose sub-IndexReaders from MultiReader or MultiSegmentReader

Posted by "robert engels (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654924#action_12654924 ] 

robert engels commented on LUCENE-1475:
---------------------------------------

That is not correct. By returning a non-null array, it is trivially to get an ordered list of all subreaders using simple recursion.

It does not need to be an interface... no reason, if adding a new method to IndexReader (and changing the implementations).

> Expose sub-IndexReaders from MultiReader or MultiSegmentReader
> --------------------------------------------------------------
>
>                 Key: LUCENE-1475
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1475
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Jason Rutherglen
>            Priority: Minor
>         Attachments: LUCENE-1475.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> MultiReader and MultiSegmentReader are package protected and do not expose the underlying sub-IndexReaders.  A way to expose the sub-readers is to have an interface that an IndexReader may be cast to that exposes the underlying readers.  
> This is for realtime indexing.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Updated: (LUCENE-1475) Expose sub-IndexReaders from MultiReader or MultiSegmentReader

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

Jason Rutherglen updated LUCENE-1475:
-------------------------------------

    Attachment: LUCENE-1475.patch

LUCENE-1475.patch

- Added getSubReaders to IndexReader which by default returns null
- Added IndexReader.isMultiReader default false.  MultiSegmentReader and MultiReader return true

I took this approach rather than add an interface as this seemed to be more with the kitchen sink IndexReader API currently in use (meaning it's not my first choice, but because it's a small addition I don't care).

> Expose sub-IndexReaders from MultiReader or MultiSegmentReader
> --------------------------------------------------------------
>
>                 Key: LUCENE-1475
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1475
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Jason Rutherglen
>            Priority: Minor
>         Attachments: LUCENE-1475.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> MultiReader and MultiSegmentReader are package protected and do not expose the underlying sub-IndexReaders.  A way to expose the sub-readers is to have an interface that an IndexReader may be cast to that exposes the underlying readers.  
> This is for realtime indexing.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


[jira] Commented: (LUCENE-1475) Expose sub-IndexReaders from MultiReader or MultiSegmentReader

Posted by "Jason Rutherglen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654923#action_12654923 ] 

Jason Rutherglen commented on LUCENE-1475:
------------------------------------------

RE:
"It should return an empty array, not null when there are no sub readers."

It should return null because there are no results.  An empty array almost implies the SegmentReader can contain other readers or that they may show up in the future.  IMO the API is garbage anyways because it should be using an interface like the JDK classes do.

MM:
"What should be returned if a Multi*Reader has embedded Multi*Readers as sub-readers?"

I don't like this approach and the comments seem sound like over engineering a simple solution.  If the user wants all the sub of sub readers, they need to write that code externally to Lucene.  Otherwise it is not easy to know what the sub readers are for the given reader.  

> Expose sub-IndexReaders from MultiReader or MultiSegmentReader
> --------------------------------------------------------------
>
>                 Key: LUCENE-1475
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1475
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Jason Rutherglen
>            Priority: Minor
>         Attachments: LUCENE-1475.patch
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> MultiReader and MultiSegmentReader are package protected and do not expose the underlying sub-IndexReaders.  A way to expose the sub-readers is to have an interface that an IndexReader may be cast to that exposes the underlying readers.  
> This is for realtime indexing.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org