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

QueryStringQueryBuilder equals == true when query is not equal #29403

Closed
jecstarinnovations opened this issue Apr 5, 2018 · 4 comments · Fixed by #29406
Closed

QueryStringQueryBuilder equals == true when query is not equal #29403

jecstarinnovations opened this issue Apr 5, 2018 · 4 comments · Fixed by #29406
Assignees
Labels
>bug :Search/Search Search-related issues that do not fall into other categories

Comments

@jecstarinnovations
Copy link

Elasticsearch version (bin/elasticsearch --version): 6.2.3

Plugins installed: [] D.N.A.

JVM version (java -version): openjdk version "1.8.0_161"

OS version (uname -a if on a Unix-like system): Linux jecstar-laptop 4.15.13-300.fc27.x86_64 #1 SMP Mon Mar 26 19:06:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior: The doEquals() method in the org.elasticsearch.index.query.QueryStringQueryBuilder is not working properly. When two different instances with different queries are compared by the equals method everything works as expected (equals() == false).
When adding an equal timezone id to both instances of the QueryStringQueryBuilder, the equals() method will return true despite the query values are not equal. This is caused because parenthesis are missing around the statement at line 928.

Steps to reproduce:
For a complete example see the attached gradle project.
querystringquerybug.tar.gz

Provide logs (if relevant): D.N.A.

@dnhatn
Copy link
Member

dnhatn commented Apr 5, 2018

@jecstarinnovations This is indeed a bug. Thanks for reporting it.

@dnhatn dnhatn added the >bug label Apr 5, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

@dnhatn dnhatn added the :Search/Search Search-related issues that do not fall into other categories label Apr 5, 2018
@cbuescher cbuescher self-assigned this Apr 5, 2018
@colings86 colings86 assigned colings86 and unassigned cbuescher Apr 6, 2018
@colings86
Copy link
Contributor

@jecstarinnovations thanks for reporting this bug. I've raised #29406 which should fix this

colings86 added a commit that referenced this issue Apr 6, 2018
* Fixes query_string query equals timezone check

This change fixes a bug where two `QueryStringQueryBuilder`s were found
to be equal if they had the same timezone set even if the query string
in the builders were different

Closes #29403

* Adds mutate function to QueryStringQueryBuilderTests

* iter
@colings86
Copy link
Contributor

@jecstarinnovations thanks for raising this issue, I've merged a fix into the master branch and will back port to the 6.x branch shortly

colings86 added a commit that referenced this issue Apr 6, 2018
* Fixes query_string query equals timezone check

This change fixes a bug where two `QueryStringQueryBuilder`s were found
to be equal if they had the same timezone set even if the query string
in the builders were different

Closes #29403

* Adds mutate function to QueryStringQueryBuilderTests

* iter

server/src/main/java/org/elasticsearch/index/query/QueryStringQueryBuild
er.java
server/src/test/java/org/elasticsearch/index/query/QueryStringQueryBuild
erTests.java
test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCas
e.java
server/src/main/java/org/elasticsearch/index/query/QueryStringQueryBuild
er.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants