lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <>
Subject [jira] Commented: (LUCENE-2154) Need a clean way for Dir/MultiReader to "merge" the AttributeSources of the sub-readers
Date Tue, 09 Feb 2010 15:27:27 GMT


Uwe Schindler commented on LUCENE-2154:

The problem is the following:

Attributes are not to be retrieved on every call to next(), they are get/added after construction.
If you have a consumer of your MultiEnum, it calls attributes().getAttribute exactly one time
before start to enumerate tokens/positions/whatever. If your proposed MultiAttributeSource
would return the attribute of the first sub-enum, the consumer would stay with this attribute
instance forever. If the MultiEnum then changes to another sub-enum, the consumer would not
see the new attribute.

Because of that the right way is not to have a MultiAttributeSource. What you need are proxy
attributes. The Attributes itsself must be proxies, delegating the call to the current enum's
corresponding attribute. The same was done in Lucene 2.9 to emulate the backwards compatibility
for TokenStreams. The proxy was TokenWrapper. These ProxyAttributes would look exactly like
this TokenWrapper impl class.

> Need a clean way for Dir/MultiReader to "merge" the AttributeSources of the sub-readers
> ---------------------------------------------------------------------------------------
>                 Key: LUCENE-2154
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: Flex Branch
>            Reporter: Michael McCandless
>             Fix For: Flex Branch
> The flex API allows extensibility at the Fields/Terms/Docs/PositionsEnum levels, for
a codec to set custom attrs.
> But, it's currently broken for Dir/MultiReader, which must somehow share attrs across
all the sub-readers.  Somehow we must make a single attr source, and tell each sub-reader's
enum to use that instead of creating its own.  Hopefully Uwe can work some magic here :)

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:
For additional commands, e-mail:

View raw message