Skip to content
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

Do not cache script queries. #20799

Merged
merged 2 commits into from Oct 11, 2016

Conversation

Projects
None yet
2 participants
@jpountz
Copy link
Contributor

commented Oct 7, 2016

The cache relies on the equals() method so we just need to make sure script
queries can never be equal, even to themselves in the case that a weight
is used to produce a Scorer on the same segment multiple times.

Closes #20763

Do not cache script queries.
The cache relies on the equals() method so we just need to make sure script
queries can never be equals, even to themselves in the case that a weight
is used to produce a Scorer on the same segment multiple times.

Closes #20763
return true;
if (sameClassAs(obj) == false)
return false;
ScriptQuery other = (ScriptQuery) obj;
return Objects.equals(script, other.script);
return Objects.equals(script, other.script);*/
return false;

This comment has been minimized.

Copy link
@s1monw

s1monw Oct 7, 2016

Contributor

I guess you have to return this == obj to ensure QueryUtils dont' go wild?

This comment has been minimized.

Copy link
@jpountz

jpountz Oct 7, 2016

Author Contributor

Caching could still happen in that case if you use the same weight create a Scorer on the same segment multiple times.

This comment has been minimized.

Copy link
@s1monw

s1monw Oct 7, 2016

Contributor

how can somebody get the SAME query unless it's the SAME query?

@jpountz

This comment has been minimized.

Copy link
Contributor Author

commented Oct 10, 2016

For the record, I talked about this change with @s1monw on Friday and we agreed that caching should not be an issue if it happened per request.

@s1monw

This comment has been minimized.

Copy link
Contributor

commented Oct 10, 2016

LGTM

@jpountz jpountz merged commit 1914df7 into elastic:master Oct 11, 2016

2 checks passed

CLA Commit author is a member of Elasticsearch
Details
elasticsearch-ci Build finished.
Details

@jpountz jpountz deleted the jpountz:fix/do_not_cache_script_queries branch Oct 11, 2016

jpountz added a commit that referenced this pull request Oct 11, 2016

Do not cache script queries. (#20799)
The cache relies on the equals() method so we just need to make sure script
queries can never be equals, even to themselves in the case that a weight
is used to produce a Scorer on the same segment multiple times.

Closes #20763

jpountz added a commit that referenced this pull request Oct 11, 2016

Do not cache script queries. (#20799)
The cache relies on the equals() method so we just need to make sure script
queries can never be equals, even to themselves in the case that a weight
is used to produce a Scorer on the same segment multiple times.

Closes #20763
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.