lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrzej Bialecki (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3836) Most Codec.*Format().*Reader() methods should use SegmentReadState
Date Thu, 01 Mar 2012 14:45:58 GMT


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:
>             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:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message