[
https://issues.apache.org/jira/browse/LUCENE-3836?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13220071#comment-13220071
]
Andrzej Bialecki commented on LUCENE-3836:
-------------------------------------------
I hear you .. SegmentWriteState is bad, I agree. But the argument about
SegmentWriteState is not really applicable to SegmentReadState - write state is
mutable and can change under your feet whereas SegmentReadState is immutable,
created once in SegmentReader and used only for initialization of format
readers. On the other hand, if we insist that we always pass individual
arguments around then providing some additional segment-global context to
format readers requires changing method signatures (adding arguments).
The background for this issue is that I started looking at updateable fields,
where updates are put in a segment (or reader) of its own and they provide an
"overlay" for the main segment, with a special codec magic to pull and remap
data from the "overlay" as the main data is accessed. However, in order to do
that I need to provide this data when format readers are initialized. I can't
do this when creating a Codec instance (Codec is automatically instantiated) or
when creating Codec.*Format(), because format instances are usually shared as
well.
So the idea I had in mind was to use SegmentReaderState uniformly, and put this
overlay data in SegmentReadState so that it's passed down to formats during
format readers' creation. I'm open to other ideas... :)
> Most Codec.*Format().*Reader() methods should use SegmentReadState
> ------------------------------------------------------------------
>
> Key: LUCENE-3836
> URL: https://issues.apache.org/jira/browse/LUCENE-3836
> Project: Lucene - Java
> Issue Type: Improvement
> Components: core/codecs
> Reporter: Andrzej Bialecki
> Assignee: Andrzej Bialecki
> Fix For: 4.0
>
> Attachments: LUCENE-3836.patch
>
>
> Codec formats API for opening readers is inconsistent - sometimes it uses
> SegmentReadState, in other cases it uses individual arguments that are
> already available via SegmentReadState. This complicates extending the API,
> e.g. if additional per-segment state would need to be passed to the readers.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]