lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Smith (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-1784) Make BooleanWeight and DisjunctionMaxWeight protected
Date Mon, 10 Aug 2009 12:38:14 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-1784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741293#action_12741293
] 

Tim Smith commented on LUCENE-1784:
-----------------------------------

it could be noted that the class will change in future versions (no back-compat guaranteed)

i need the ability to be able to walk the weights recursively in order to do some rather nasty
post-query analysis 

another alternative would be to add a "getWeights() method to the Weight/QueryWeight interface/class
in order to allow generically walking query weights
this would then allow me to walk the weights as needed. Sadly i cannot walk the queries themselves
because what i need is something that isn't resolved until Weight creation time (and this
could be very expensive to recreate from the query)

i guess this idea is somewhat complicated by the fact that Weight is an interface (and you
then get compile time back compat issues)

if the ability to walk the weights is not exposed, i'll just have to hack it in (copy source
of these 2 classes and expose them as protected) and i prefer to not do this (much prefer
using a pristine lucene distro)

> 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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message