You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Bernd Fondermann (JIRA)" <ji...@apache.org> on 2009/09/18 17:46:16 UTC

[jira] Created: (LUCENE-1920) Make MultiReader.isOptimized() return a useful result

Make MultiReader.isOptimized() return a useful result
-----------------------------------------------------

                 Key: LUCENE-1920
                 URL: https://issues.apache.org/jira/browse/LUCENE-1920
             Project: Lucene - Java
          Issue Type: Improvement
          Components: Index
            Reporter: Bernd Fondermann
            Priority: Minor


The MultiReader statically returns FALSE on any isOptimized() call.
This makes it unusable as the source index for an InstantiatedIndex, which checks initially if the source index is optimized and aborts if not.
The attached patch iterates all sub readers and returns TRUE if all of them are optimized.

-- 
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-1920) Make MultiReader.isOptimized() return a useful result

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12757240#action_12757240 ] 

Mark Miller commented on LUCENE-1920:
-------------------------------------

   * Requests an "optimize" operation on an index, priming the index
   * for the fastest available search. Traditionally this has meant
   * merging all segments into a single segment as is done in the
   * default merge policy, but individaul merge policies may implement
   * optimize in different ways.

This actually almost argues for your solution. Put me on the fence.

> Make MultiReader.isOptimized() return a useful result
> -----------------------------------------------------
>
>                 Key: LUCENE-1920
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1920
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Bernd Fondermann
>            Priority: Minor
>         Attachments: MultiReader_isOptimized.patch
>
>
> The MultiReader statically returns FALSE on any isOptimized() call.
> This makes it unusable as the source index for an InstantiatedIndex, which checks initially if the source index is optimized and aborts if not.
> The attached patch iterates all sub readers and returns TRUE if all of them are optimized.

-- 
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-1920) Make MultiReader.isOptimized() return a useful result

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

Bernd Fondermann updated LUCENE-1920:
-------------------------------------

    Attachment: MultiReader_isOptimized.patch

> Make MultiReader.isOptimized() return a useful result
> -----------------------------------------------------
>
>                 Key: LUCENE-1920
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1920
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Bernd Fondermann
>            Priority: Minor
>         Attachments: MultiReader_isOptimized.patch
>
>
> The MultiReader statically returns FALSE on any isOptimized() call.
> This makes it unusable as the source index for an InstantiatedIndex, which checks initially if the source index is optimized and aborts if not.
> The attached patch iterates all sub readers and returns TRUE if all of them are optimized.

-- 
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-1920) Make MultiReader.isOptimized() return a useful result

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12757250#action_12757250 ] 

Uwe Schindler commented on LUCENE-1920:
---------------------------------------

Was there not any issue that fixes InstantiatedIndex to also accept non-optimized indexes?

> Make MultiReader.isOptimized() return a useful result
> -----------------------------------------------------
>
>                 Key: LUCENE-1920
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1920
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Bernd Fondermann
>            Priority: Minor
>         Attachments: MultiReader_isOptimized.patch
>
>
> The MultiReader statically returns FALSE on any isOptimized() call.
> This makes it unusable as the source index for an InstantiatedIndex, which checks initially if the source index is optimized and aborts if not.
> The attached patch iterates all sub readers and returns TRUE if all of them are optimized.

-- 
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-1920) Make MultiReader.isOptimized() return a useful result

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

Yonik Seeley commented on LUCENE-1920:
--------------------------------------

I agree with the patch - MulitReader is not used by Lucene natively, so it's always instantiated by a user with multiple sub-readers, that are normally complete indexes on their own.  If they are all optimized, then the top-level should be optimized.

It's minor though, because the user could also check the optimization status of the sub-readers themselves.

As for instantiatedIndex, that's a different issue - I don't know why it thinks it needs an optimized index (no deletions? single segment? both?) but it should check a different way.


> Make MultiReader.isOptimized() return a useful result
> -----------------------------------------------------
>
>                 Key: LUCENE-1920
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1920
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Bernd Fondermann
>            Priority: Minor
>         Attachments: MultiReader_isOptimized.patch
>
>
> The MultiReader statically returns FALSE on any isOptimized() call.
> This makes it unusable as the source index for an InstantiatedIndex, which checks initially if the source index is optimized and aborts if not.
> The attached patch iterates all sub readers and returns TRUE if all of them are optimized.

-- 
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-1920) Make MultiReader.isOptimized() return a useful result

Posted by "Bernd Fondermann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12757377#action_12757377 ] 

Bernd Fondermann commented on LUCENE-1920:
------------------------------------------

Thank you all for taking the time to review the patch.
I'm not that familiar with the inner workings of Lucene and the full (intented) contract of isOptimized().

Just a few observations I made by looking at Lucene's source more closely:

+ My patch was originally crafted and tested against 2.4.0-RELEASE.
However, InstantiatedIndex in TRUNK no longer throws an exception on non-optimized wrapped indizes, see LUCENE-1578. 
So this no longer should be a problem (although I don't know if this is tested well enough) and the patch can be looked at conservatively.

+ Nevertheless, I think it's releasonable (from a user's perspecitve) to expect a behavior like the patch is providing.

+ This is supported by ParallelReader.isOptimized() (see LUCENE-832), which is doing essentially the same thing like the proposed patch for MultiReader.
 So this behavior is already implemented in a similar Reader.



> Make MultiReader.isOptimized() return a useful result
> -----------------------------------------------------
>
>                 Key: LUCENE-1920
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1920
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Bernd Fondermann
>            Priority: Minor
>         Attachments: MultiReader_isOptimized.patch
>
>
> The MultiReader statically returns FALSE on any isOptimized() call.
> This makes it unusable as the source index for an InstantiatedIndex, which checks initially if the source index is optimized and aborts if not.
> The attached patch iterates all sub readers and returns TRUE if all of them are optimized.

-- 
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-1920) Make MultiReader.isOptimized() return a useful result

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1920?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12757236#action_12757236 ] 

Mark Miller commented on LUCENE-1920:
-------------------------------------

An optimized index is a single segment - MultiReader reads from multiple segments, and so I would argue its not optimized and should return false.

If InstantiatedIndex will work when all of the segments MultiReader refs are optimized somehow, I believe the workaround belongs in InstantiatedIndex.

Counterpoints?

> Make MultiReader.isOptimized() return a useful result
> -----------------------------------------------------
>
>                 Key: LUCENE-1920
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1920
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Bernd Fondermann
>            Priority: Minor
>         Attachments: MultiReader_isOptimized.patch
>
>
> The MultiReader statically returns FALSE on any isOptimized() call.
> This makes it unusable as the source index for an InstantiatedIndex, which checks initially if the source index is optimized and aborts if not.
> The attached patch iterates all sub readers and returns TRUE if all of them are optimized.

-- 
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