You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The doEquals() and doHashCode() methods in NeuralQueryBuilder fail to account for all parameters that influence query results. This oversight can lead to scenarios where two queries are mistakenly identified as equal, even though their outcomes differ.
How can one reproduce the bug?
Whenever two NeuralQueryBuilder instances have differing parameters that are not accounted for in the doEquals() and doHashCode() methods, these methods will incorrectly identify the instances as equal.
Below is the current implementation:
@Override
protected boolean doEquals(NeuralQueryBuilder obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
EqualsBuilder equalsBuilder = new EqualsBuilder();
equalsBuilder.append(fieldName, obj.fieldName);
equalsBuilder.append(queryText, obj.queryText);
equalsBuilder.append(modelId, obj.modelId);
equalsBuilder.append(k, obj.k);
equalsBuilder.append(filter, obj.filter);
return equalsBuilder.isEquals();
}
@Override
protected int doHashCode() {
return new HashCodeBuilder().append(fieldName).append(queryText).append(modelId).append(k).toHashCode();
}
What is the expected behavior?
doEquals() and doHashCode() methods should account for all the parameters that can impact the query result.
What is your host/environment?
N/A
Do you have any screenshots?
N/A
Do you have any additional context?
If these methods are used for OpenSearch caching, it could lead to incorrect results being returned when the difference between a new query and an old query lies solely in the parameters that are not considered. Further investigation is required to understand how these two functions are utilized within OpenSearch.
The text was updated successfully, but these errors were encountered:
that's interesting finding, thanks fro reporting it. There is a filter field that is missing from the hashCode method. Do you know scenario (in core or plugin specific) where we see effect of this?
What is the bug?
The doEquals() and doHashCode() methods in NeuralQueryBuilder fail to account for all parameters that influence query results. This oversight can lead to scenarios where two queries are mistakenly identified as equal, even though their outcomes differ.
How can one reproduce the bug?
Whenever two NeuralQueryBuilder instances have differing parameters that are not accounted for in the doEquals() and doHashCode() methods, these methods will incorrectly identify the instances as equal.
Below is the current implementation:
What is the expected behavior?
doEquals() and doHashCode() methods should account for all the parameters that can impact the query result.
What is your host/environment?
N/A
Do you have any screenshots?
N/A
Do you have any additional context?
If these methods are used for OpenSearch caching, it could lead to incorrect results being returned when the difference between a new query and an old query lies solely in the parameters that are not considered. Further investigation is required to understand how these two functions are utilized within OpenSearch.
The text was updated successfully, but these errors were encountered: