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

Simon Willnauer commented on LUCENE-2590:
-----------------------------------------

bq. Oh I see we can't quite have Scorer impl this because it doesn't know the 
query. But maybe we can factor out a common method, that the subclass passed 
the query to?
I had the same idea in a previous iteration but since Scorer doesn't know about 
the Query the scorer concerns I can not do the call. One way of doing it would 
be adding the scorers {{Weight}} as a protected final member since {{Weight}} 
already has a {{#getQuery()}} method we can easily access it or throw an 
UnsupportedOperationException if the weight is null (force it via ctor and have 
a default one which sets it to null).

Since the most of the scorers know their {{Weight}} anyway and would need to 
call the visitor we can also factor it out.


bq. Also, we are missing some scorers (SpanScorer, 
ConstantScoreQuery.ConstantScorer, probably others), but if we do the super 
approach, we'd get these "for free" (I think?).
most of them would then be for free though!

Thoughts?

> Enable access to the freq information in a Query's sub-scorers
> --------------------------------------------------------------
>
>                 Key: LUCENE-2590
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2590
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Search
>            Reporter: Michael McCandless
>            Assignee: Simon Willnauer
>         Attachments: LUCENE-2590.patch, LUCENE-2590.patch, LUCENE-2590.patch, 
> LUCENE-2590.patch
>
>
> The ability to gather more details than just the score, of how a given
> doc matches the current query, has come up a number of times on the
> user's lists.  (most recently in the thread "Query Match Count" by
> Ryan McV on java-user).
> EG if you have a simple TermQuery "foo", on each hit you'd like to
> know how many times "foo" occurred in that doc; or a BooleanQuery +foo
> +bar, being able to separately see the freq of foo and bar for the
> current hit.
> Lucene doesn't make this possible today, which is a shame because
> Lucene in fact does compute exactly this information; it's just not
> accessible from the Collector.

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

Reply via email to