[
https://issues.apache.org/jira/browse/LUCENE-2772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Uwe Schindler updated LUCENE-2772:
----------------------------------
Attachment: LUCENE-2772.patch
Here the patch:
- When SlowMultiReaderWrapper will in future clean up the cache on close, the
tests should not simply only close inner reader but instead close wrapper
reader (which only delegates currently). This is also the only correct usage
for Decoration pattern (see TokenFilter & co.)
- TestFilterIndexReader had a bug when the "source" index has more than one
segment, this is fixed now, because we always wrap and wrapped reader delegates
close.
> Make SlowMultiReaderWrapper wrap always so close() is safe
> ----------------------------------------------------------
>
> Key: LUCENE-2772
> URL: https://issues.apache.org/jira/browse/LUCENE-2772
> Project: Lucene - Java
> Issue Type: Sub-task
> Reporter: Uwe Schindler
> Assignee: Uwe Schindler
> Fix For: 4.0
>
> Attachments: LUCENE-2772.patch
>
>
> The overhead when wrapping an atomic reader using SlowMultiReaderWrapper is
> very low, the work done in the static wrap method is much higher (instantiate
> ArrayList, recusively went through all subreaders), just to check the number
> of readers than simply always wrapping.
> MultiFields already is optimized when called by one-segment or atomic
> readers, so there is no overhead at all. So this patch removes the static
> wrap method and you simply wrap like a TokenFilter with ctor: new
> SlowMultiReaderWrapper(reader)
> When this is done, there is also no risk to close a SegmentReader (which you
> should not do), when wrap() returns a single SegmentReader. This help in
> parent issue with cleaning up the case in close().
> The patch aƶlso removes the now useless mainReader/reader variables and
> simply closes the wrapper.
--
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: [email protected]
For additional commands, e-mail: [email protected]