lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Renaud Delbru (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 16:21:28 GMT


Renaud Delbru commented on LUCENE-2154:

I see. The problem is to return to the consumer a unique attribute reference when attributes().getAttribute
is called, and then updates the references when iterating the enums in order to propagate
the attribute changes to the consumer.

I am trying to propose a (possible) alternative solution (if I understood the problem correctly),
which can avoid reflection, but could potentially need a modification of the Attribute interface.

If the MultiAttributeSource will create its own set of unique references for each attribute
(the list of different attribute classes can be retrieved by calling the getAttributeClassesIterator()
method of the AttributeSource for each subreader, we can then create a list of unique references,
one reference for each type of attributes), the goal is then to update these references after
each enum iteration or sub-enum change (in order to propagate the changes to the consumer).

Unfortunately, I don't see any interface on the Attribute interface to 'copy' a given attribute.
Each AttributeImpl could implement this 'copy method', which copies the state of a given attribute
of the same class.
Then, in the MultiDocsAndPositionsEnum, after each iteration or each sub-enum change, a call
to MultiAttributeSource can be made explicitly to update the unique references of the different
attributes. This update method will under the hood (1) check if the sub-enum is aware of the
attribute class, (2) get the attribute from the sub-enum, and (3) copy the attribute to the
unique attribute reference kept by MultiAttributeSource.

Could this solution possibly work ?

> 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