[
https://issues.apache.org/jira/browse/LUCENE-1784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741303#action_12741303
]
Tim Smith commented on LUCENE-1784:
-----------------------------------
Here's another approach that may be more desirable:
add a TraversableWeight interface:
{code}
public interface TraversableWeight extends Weight {
List/*<Weight>*/ getWeights();
}
{code}
then, DisjunctionMaxWeight and BooleanWeight could implement TraversableWeight
this way, as i traverse the weights, I can check (weight instanceof
TraversableWeight) and then traverse the child weights as needed
i can call weight.getQuery() to see if it was a BooleanQuery or a
DisjunctionMaxQuery
If this is more acceptable, i can work up a patch
> Make BooleanWeight and DisjunctionMaxWeight protected
> -----------------------------------------------------
>
> Key: LUCENE-1784
> URL: https://issues.apache.org/jira/browse/LUCENE-1784
> Project: Lucene - Java
> Issue Type: Improvement
> Affects Versions: 2.4
> Reporter: Tim Smith
> Priority: Minor
> Attachments: LUCENE-1784.patch
>
>
> Currently, BooleanWeight is private, yet it has 2 protected members
> (similarity, weights) which are unaccessible from custom code
> i have some use cases where it would be very useful to crawl a BooleanWeight
> to get at the sub Weight objects
> however, since BooleanWeight is private, i have no way of doing this
> If BooleanWeight is protected, then i can subclass BooleanQuery to hook in
> and wrap BooleanWeight with a subclass to facilitate this walking of the
> Weight objects
> Would also want DisjunctionMaxWeight to be protected, along with its
> "weights" member
> Would be even better if these Weights were made public with accessors to
> their sub "weights" objects (then no subclassing would be necessary on my
> part)
> this should be really trivial and would be great if it can get into 2.9
> more generally, it would be nice if all Weight classes were public with nice
> accessors to relevant "sub weights"/etc so custom code can get its hooks in
> where and when desired
--
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]