fabriziofortino commented on code in PR #1149:
URL: https://github.com/apache/jackrabbit-oak/pull/1149#discussion_r1363811448
##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticIndexStatistics.java:
##########
@@ -251,26 +264,33 @@ static class StatsRequestDescriptor {
final String index;
@Nullable
final String field;
+ @Nullable
+ final Query query;
StatsRequestDescriptor(@NotNull ElasticConnection connection,
@NotNull String index) {
- this(connection, index, null);
+ this(connection, index, null, null);
}
StatsRequestDescriptor(@NotNull ElasticConnection connection,
- @NotNull String index, @Nullable String field) {
+ @NotNull String index, @Nullable String field,
@Nullable Query query) {
this.connection = connection;
this.index = index;
this.field = field;
+ this.query = query;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StatsRequestDescriptor that = (StatsRequestDescriptor) o;
+ String thisInternalQuery = query != null ? query.toString() : null;
+ String thatInternalQuery = that.query != null ?
that.query.toString() : null;
return index.equals(that.index) &&
- Objects.equals(field, that.field);
+ Objects.equals(field, that.field) &&
+ // ES Query objects are not comparable, so we need to
compare their string representations
+ Objects.equals(thisInternalQuery, thatInternalQuery);
}
Review Comment:
good catch! Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]