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

Michael Gibney commented on SOLR-16162:
---------------------------------------

The approach taken in [PR #814|https://github.com/apache/solr/pull/814] is very 
straightforward.

Internal to the Solr code, FilterQuery could easily be a final class, but it is 
not. Consequently, the only potential issue I can imagine with this is that in 
principle, third parties could have written plugins that extend the public 
class FilterQuery. If they did so, it would likely have overridden 
{{createWeight(...)}} ... but with this change, in (most?) contexts, the custom 
{{createWeight()}} would be ignored, and a DocSet retrieved directly from 
{{createDocSet()}}.

Is it worth dancing around this (e.g. via introspection to determine whether 
the class has been extended?), or making FilterQuery final? I could see an 
argument for the latter: The functionality that FilterQuery provides is not 
particularly complex, and any overriding would be for minimal convenience (and 
arguably dangerous, based on the special handling that FilterQuery receieves 
via instanceof checks.

I guess my inclination would be to make FilterQuery final as part of this PR. 
Thoughts?

> FilterQuery (`filter([some_query])`) should implement DocSetProducer
> --------------------------------------------------------------------
>
>                 Key: SOLR-16162
>                 URL: https://issues.apache.org/jira/browse/SOLR-16162
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: query parsers
>    Affects Versions: main (10.0)
>            Reporter: Michael Gibney
>            Assignee: Michael Gibney
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> There is a substantial practical reason for FilterQuery to implement 
> DocSetProducer: the way FilterQuery works, it only consults the cache 
> internally for the backing query; the cache is never directly consulted for 
> the FilterQuery _per se_. As a consequence, when FilterQuery is used in a 
> context that wants a DocSet, currently (without implementing DocSetProducer), 
> a full clone of the cached DocSet must always be built via the Weight 
> returned by FilterQuery.createWeight(). Implementing DocSetProducer allows to 
> avoid superfluous DocSet creation.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to