aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-10-27 17:51:58 +0100
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-10-27 18:35:25 +0100
commit475f89e829fee978c2f01395cd13fc2f9951bb7c (patch)
tree531841c93b0d2ae8579398a0fd9bb87426d7a949 /server
parent1e640c5abfbabf63c364b004df1d11156186ec0a (diff)
downloadsonarqube-475f89e829fee978c2f01395cd13fc2f9951bb7c.tar.gz
sonarqube-475f89e829fee978c2f01395cd13fc2f9951bb7c.zip
SONAR-5718 Fix stickyness of unassigned/unresolved facet items
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java10
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java5
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json3
4 files changed, 12 insertions, 8 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
index 825ad80f0a2..25252092bc5 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/issue/index/IssueIndex.java
@@ -342,7 +342,10 @@ public class IssueIndex extends BaseIndex<Issue, IssueDto, String> {
String facetName = IssueFilterParameters.ASSIGNEES;
// Same as in super.stickyFacetBuilder
- BoolFilterBuilder facetFilter = getStickyFacetFilter(esQuery, filters, fieldName);
+ Map<String, FilterBuilder> assigneeFilters = Maps.newHashMap(filters);
+ assigneeFilters.remove("__isAssigned");
+ assigneeFilters.remove(fieldName);
+ BoolFilterBuilder facetFilter = getStickyFacetFilter(esQuery, assigneeFilters, fieldName);
FilterAggregationBuilder facetTopAggregation = buildTopFacetAggregation(fieldName, facetName, facetFilter);
addSelectedItemsToFacet(fieldName, facetName, facetTopAggregation, query.assignees().toArray());
@@ -363,7 +366,10 @@ public class IssueIndex extends BaseIndex<Issue, IssueDto, String> {
String facetName = IssueFilterParameters.RESOLUTIONS;
// Same as in super.stickyFacetBuilder
- BoolFilterBuilder facetFilter = getStickyFacetFilter(esQuery, filters, fieldName);
+ Map<String, FilterBuilder> resolutionFilters = Maps.newHashMap(filters);
+ resolutionFilters.remove("__isResolved");
+ resolutionFilters.remove(fieldName);
+ BoolFilterBuilder facetFilter = getStickyFacetFilter(esQuery, resolutionFilters, fieldName);
FilterAggregationBuilder facetTopAggregation = buildTopFacetAggregation(fieldName, facetName, facetFilter);
addSelectedItemsToFacet(fieldName, facetName, facetTopAggregation, query.resolutions().toArray());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java b/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
index 5055fb07b75..b1d4c86cd71 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
@@ -22,7 +22,6 @@ package org.sonar.server.rule.index;
import com.google.common.base.Preconditions;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequestBuilder;
@@ -342,7 +341,6 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
Map<String, FilterBuilder> filters = this.getFilters(query, options);
if (options.isFacet()) {
- Logger.getLogger(this.getClass()).info("Facets = " + options.facets());
for (AggregationBuilder aggregation : getFacets(qb, filters).values()) {
esSearch.addAggregation(aggregation);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java
index 74c2988e1fd..19694bb1aab 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/SearchActionMediumTest.java
@@ -339,13 +339,14 @@ public class SearchActionMediumTest {
.setDebt(10L)
.setProject(project)
.setComponent(file)
- .setStatus("OPEN").setResolution("OPEN")
+ .setStatus("OPEN")
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
.setSeverity("MAJOR");
db.issueDao().insert(session, issue);
session.commit();
WsTester.Result result = wsTester.newGetRequest(IssuesWs.API_ENDPOINT, SearchAction.SEARCH_ACTION)
+ .setParam("resolved", "false")
.setParam(SearchAction.PARAM_FACETS, "statuses,severities,resolutions,componentRoots,rules,components,assignees,languages")
.execute();
result.assertJson(this.getClass(), "display_facets.json", false);
@@ -360,7 +361,7 @@ public class SearchActionMediumTest {
.setDebt(10L)
.setProject(project)
.setComponent(file)
- .setStatus("OPEN").setResolution("OPEN")
+ .setStatus("OPEN")
.setKee("82fd47d4-b650-4037-80bc-7b112bd4eac2")
.setSeverity("MAJOR");
db.issueDao().insert(session, issue);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json
index 6339c4e44c1..d49a4bd23fb 100644
--- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json
+++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/display_facets.json
@@ -6,7 +6,6 @@
"project": "MyProject",
"rule": "xoo:x1",
"status": "OPEN",
- "resolution": "OPEN",
"severity": "MAJOR",
"debt": "10min",
"fUpdateAge": "less than a minute"
@@ -35,7 +34,7 @@
"property": "resolutions",
"values": [
{
- "val": "OPEN",
+ "val": "",
"count": 1
}
]