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

Mike Drob commented on LUCENE-6232:
-----------------------------------

bq. It's called QueryContext since it seemed it could be more generic than just 
for value sources.
Naming things is one of Computer Science's greatest unsolved problems. I 
initially called mine QueryContext but decided it might be too broad. No 
objections to changing it back.

bq. If we switch from IdentityHashMap (which is currently used) to HashMap, it 
might be good to make sure any heavy-weight equals implementations check for 
other==this.
This is a good idea regardless.

bq. That seems rather specific to a particular kind of value source and 
probably doesn't belong at this level?
Yes, this is only used in one place. Easy enough to remove, but then we will 
have more usage of the unsafe {{put()}}. I have toyed around with creating 
subclasses for the context that can safely store a CollapseScore or other 
common patterns, but have yet t ocome up with something satisfactory. Maybe we 
just put this off for now.

bq. Here's the one I came up with in Heliosearch
I'm glad it looks like we went down similar paths. I'll borrow some ideas from 
here and put up a new patch.

> Replace ValueSource context Map with a more concrete data type
> --------------------------------------------------------------
>
>                 Key: LUCENE-6232
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6232
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Mike Drob
>         Attachments: LUCENE-6232.patch, LUCENE-6232.patch
>
>
> Inspired by LUCENE-3973
> The context object used by ValueSource and friends is a raw Map that provides 
> no type safety guarantees. In our current state, there are lots of warnings 
> about unchecked casts, raw types, and generally unsafe code from the 
> compiler's perspective.
> There are several common patterns and types of Objects that we store in the 
> context. It would be beneficial to instead use a class with typed methods for 
> get/set of Scorer, Weights, etc.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to