diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-10-24 15:47:15 +0200 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-10-24 15:47:22 +0200 |
commit | 0bf506894647bcc22e0c43e64b58c713c02f1037 (patch) | |
tree | 7f68c78b474b6ee3c9aa8115c64f6c23009e23b3 /server/sonar-server | |
parent | 5119dc8f3678bfc07a7a65fcd35023d7749aa585 (diff) | |
download | sonarqube-0bf506894647bcc22e0c43e64b58c713c02f1037.tar.gz sonarqube-0bf506894647bcc22e0c43e64b58c713c02f1037.zip |
SONAR-5718 Fix duplicate entries in facets on selected items
Diffstat (limited to 'server/sonar-server')
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/search/FacetValue.java | 12 | ||||
-rw-r--r-- | server/sonar-server/src/main/java/org/sonar/server/search/Result.java | 4 |
2 files changed, 14 insertions, 2 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/FacetValue.java b/server/sonar-server/src/main/java/org/sonar/server/search/FacetValue.java index 686d7fac64b..57dbe6f3a82 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/search/FacetValue.java +++ b/server/sonar-server/src/main/java/org/sonar/server/search/FacetValue.java @@ -21,6 +21,8 @@ package org.sonar.server.search; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; public class FacetValue { @@ -60,4 +62,14 @@ public class FacetValue { this.subFacets = subFacets; return this; } + + @Override + public boolean equals(Object other) { + return EqualsBuilder.reflectionEquals(this, other); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/Result.java b/server/sonar-server/src/main/java/org/sonar/server/search/Result.java index 24ba8d755fa..bc2736595e6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/search/Result.java +++ b/server/sonar-server/src/main/java/org/sonar/server/search/Result.java @@ -20,7 +20,7 @@ package org.sonar.server.search; import com.google.common.base.Preconditions; -import com.google.common.collect.LinkedListMultimap; +import com.google.common.collect.LinkedHashMultimap; import com.google.common.collect.Multimap; import org.apache.commons.lang.builder.ReflectionToStringBuilder; import org.elasticsearch.action.search.SearchResponse; @@ -54,7 +54,7 @@ public class Result<K> { public Result(@Nullable BaseIndex<K, ?, ?> index, SearchResponse response) { this.index = index; this.scrollId = response.getScrollId(); - this.facets = LinkedListMultimap.create(); + this.facets = LinkedHashMultimap.create(); this.total = (int) response.getHits().totalHits(); this.hits = new ArrayList<K>(); if (index != null) { |