[
https://issues.apache.org/jira/browse/LUCENE-2154?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12831483#action_12831483
]
Renaud Delbru commented on LUCENE-2154:
---------------------------------------
Sorry in advance, maybe what I am saying is out of scope due to my partial
understanding of the problem.
I have start to look at the problem, in order to be able to use my own
attributes from my own DocsAdnPositionsEnum classes.
would it not be simpler to create a MultiAttributeSource that is instantiated
in the MultiDocsAndPositionsEnum. At creation time, all the AttributeSource of
the subreaders (which are available) will be passed in its constructor. This
MultiAttributeSource will delegate the getAttribute call to the right
DocsAndPositionsEnum$AttributeSource.
There is not a single AttributeSource shared by all the subreader, but each
subreader keeps its own AttributeSource. In this way, attributes are not
overridden. The MultiAttributeSource is in fact like a Wrapper.
One problem is when there is custom attributes, e.g. BoostAttribute. If I
understand correctly, if the user tries to access the BoostAttribute, but one
of the subreader does not know it, the IllegalArgumentException will be thrown.
Under the hood, the MultiAttributeSource can check if the attribute exists on
the current subreader, and if not it can rely on a default attribute, or a
previously stored attribute (coming from a previous subreader).
I am not sure if what I am saying is making some sense. It looks to me too
simple to cover all the cases. Are there cases I am not aware of ? Could you
give me some examples to make me aware of other problems ?
> Need a clean way for Dir/MultiReader to "merge" the AttributeSources of the
> sub-readers
> ---------------------------------------------------------------------------------------
>
> Key: LUCENE-2154
> URL: https://issues.apache.org/jira/browse/LUCENE-2154
> 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: [email protected]
For additional commands, e-mail: [email protected]