New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOLR-16002: don't double-cache FilterQuery #624
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears this is obsoleted by the PR that made Filter go away -- see for yourself. I did and your test still passes without the change you did in SolrIndexSearcher :-). I didn't dig into why exactly though I would be curious if you could find out. I like your test -- you should add it nonetheless.
solr/core/src/test/org/apache/solr/search/TestFiltersQueryCaching.java
Outdated
Show resolved
Hide resolved
solr/core/src/test/org/apache/solr/search/TestFiltersQueryCaching.java
Outdated
Show resolved
Hide resolved
solr/core/src/test/org/apache/solr/search/TestFiltersQueryCaching.java
Outdated
Show resolved
Hide resolved
I'm confused at our differing experience. I just updated and added an |
That's definitely strange!
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh; yes I overlooked that.
The additional special cases kind of has a smell to it that wants for a more elegant solution. I spent some time with the code closely now and I'm thinking that FilterQuery should extend WrappedQuery. WDYT?
I'd also prefer that FilterQuery.getCache is respected, which will happen if FilterQuery extends WrappedQuery but isn't respected with your PR as-is.
WrappedQuery would then be non-final, but it's constructor would be package-private to restrain abuse. Instead it could have a "wrap" static. For even greater ease-of-use, that wrap method could take the cache & cost values as parameters and only conditionally actually wrap if they differ from defaults. Just an idea. |
Hmm... the danger with that is that although FilterQuery does wrap a query, the semantics of WrappedQuery are that the inner query should be accessible, and that at a certain point in the docset-creation-from-query code it is proper to "unwrap" the query and run the inner query. The semantics of FilterQuery are different. If there's a way to provide access to the backing query, it can't/shouldn't be leveraged in the same way that it is for WrappedQuery, so the "instanceof" checks for WrappedQuery would not be appropriate to use I think. What if FilterQuery (which already extends ExtendedQueryBase) simply overrode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was exploring that path too (what you did just now) and what I didn't like about it is that it blocks using FilterQuery to mean filter but not cache. But I suppose that's okay... whoever creates this thing could consider this scenario and simply boost a ConstantScoreQuery and get the same result.
Does this mean that local params |
No, it doesn't mean that. It's confusing but |
The fact that |
I think I follow? Yes, FilterQuery here is as in So, just to clarify, your comment above should no longer be a concern (i.e., |
Sorry, I misunderstood what you meant in your comment above. But in any event I still think the concern is not warranted:
|
So the use case we're trying to support is "fq=filter(foo:bar) OR foo:baz"? |
Well " So appropriately, this example would result in two filterCache consultations. This PR addresses the case where I guess the way I think about it, |
Thanks again David and Mike; I just wanted to call out one minor change (in 1b4d7d1): instead of throwing an IllegalArgumentException upon attempting FilterQuery.setCache(true), we now silently ignore this at the implementation level, considering that because of what FilterQuery is, the higher-level semantics of I plan to commit tomorrow, pending further feedback/concerns. |
See: SOLR-16002