Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-8114: in Grouping.java rename groupSort to withinGroupSort

Christine Poerschke64c73ef6a291
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 3c1465fc4b2..e01fe04c577 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -118,6 +118,8 @@ Other Changes
* SOLR-8132: HDFSDirectoryFactory now defaults to using the global block cache. (Mark Miller)
+* SOLR-8114: in Grouping.java rename groupSort to withinGroupSort (Christine Poerschke)
+
================== 5.4.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
diff --git a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
index acfc287e06f..736041c9e94 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
@@ -461,7 +461,7 @@ public class QueryComponent extends SearchComponent
Grouping grouping =
new Grouping(searcher, result, cmd, cacheSecondPassSearch, maxDocsPercentageToCache, groupingSpec.isMain());
grouping.setSort(groupingSpec.getGroupSort())
- .setGroupSort(groupingSpec.getSortWithinGroup())
+ .setWithinGroupSort(groupingSpec.getSortWithinGroup())
.setDefaultFormat(groupingSpec.getResponseFormat())
.setLimitDefault(limitDefault)
.setDefaultTotalCount(defaultTotalCount)
diff --git a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
index 000189066c8..438ac9ba9ba 100644
--- a/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
+++ b/solr/core/src/java/org/apache/solr/request/SimpleFacets.java
@@ -268,7 +268,7 @@ public class SimpleFacets {
DocSet base = searcher.getDocSet(qlist);
if (rb.grouping() && rb.getGroupingSpec().isTruncateGroups()) {
Grouping grouping = new Grouping(searcher, null, rb.getQueryCommand(), false, 0, false);
- grouping.setGroupSort(rb.getGroupingSpec().getSortWithinGroup());
+ grouping.setWithinGroupSort(rb.getGroupingSpec().getSortWithinGroup());
if (rb.getGroupingSpec().getFields().length > 0) {
grouping.addFieldCommand(rb.getGroupingSpec().getFields()[0], req);
} else if (rb.getGroupingSpec().getFunctions().length > 0) {
diff --git a/solr/core/src/java/org/apache/solr/search/Grouping.java b/solr/core/src/java/org/apache/solr/search/Grouping.java
index 7a0d4663688..d676240d75e 100644
--- a/solr/core/src/java/org/apache/solr/search/Grouping.java
+++ b/solr/core/src/java/org/apache/solr/search/Grouping.java
@@ -91,7 +91,7 @@ public class Grouping {
private final int maxDocsPercentageToCache;
private Sort sort;
- private Sort groupSort;
+ private Sort withinGroupSort;
private int limitDefault;
private int docsPerGroupDefault;
private int groupOffsetDefault;
@@ -158,7 +158,7 @@ public class Grouping {
}
Grouping.CommandField gc = new CommandField();
- gc.groupSort = groupSort;
+ gc.withinGroupSort = withinGroupSort;
gc.groupBy = field;
gc.key = field;
gc.numGroups = limitDefault;
@@ -201,7 +201,7 @@ public class Grouping {
commandFunc.groupBy = new QueryValueSource(q, 0.0f);
gc = commandFunc;
}
- gc.groupSort = groupSort;
+ gc.withinGroupSort = withinGroupSort;
gc.key = groupByStr;
gc.numGroups = limitDefault;
gc.docsPerGroup = docsPerGroupDefault;
@@ -228,7 +228,7 @@ public class Grouping {
Query gq = parser.getQuery();
Grouping.CommandQuery gc = new CommandQuery();
gc.query = gq;
- gc.groupSort = groupSort;
+ gc.withinGroupSort = withinGroupSort;
gc.key = groupByStr;
gc.numGroups = limitDefault;
gc.docsPerGroup = docsPerGroupDefault;
@@ -256,8 +256,8 @@ public class Grouping {
return this;
}
- public Grouping setGroupSort(Sort groupSort) {
- this.groupSort = groupSort;
+ public Grouping setWithinGroupSort(Sort withinGroupSort) {
+ this.withinGroupSort = withinGroupSort;
return this;
}
@@ -309,12 +309,12 @@ public class Grouping {
needScores = (cmd.getFlags() & SolrIndexSearcher.GET_SCORES) != 0;
boolean cacheScores = false;
- // NOTE: Change this when groupSort can be specified per group
+ // NOTE: Change this when withinGroupSort can be specified per group
if (!needScores && !commands.isEmpty()) {
- if (commands.get(0).groupSort == null) {
+ if (commands.get(0).withinGroupSort == null) {
cacheScores = true;
} else {
- for (SortField field : commands.get(0).groupSort.getSort()) {
+ for (SortField field : commands.get(0).withinGroupSort.getSort()) {
if (field.getType() == SortField.Type.SCORE) {
cacheScores = true;
break;
@@ -525,7 +525,7 @@ public class Grouping {
public abstract class Command<GROUP_VALUE_TYPE> {
public String key; // the name to use for this group in the response
- public Sort groupSort; // the sort of the documents *within* a single group.
+ public Sort withinGroupSort; // the sort of the documents *within* a single group.
public Sort sort; // the sort between groups
public int docsPerGroup; // how many docs in each group - from "group.limit" param, default=1
public int groupOffset; // the offset within each group (for paging within each group)
@@ -760,7 +760,7 @@ public class Grouping {
int groupedDocsToCollect = getMax(groupOffset, docsPerGroup, maxDoc);
groupedDocsToCollect = Math.max(groupedDocsToCollect, 1);
secondPass = new TermSecondPassGroupingCollector(
- groupBy, topGroups, sort, groupSort, groupedDocsToCollect, needScores, needScores, false
+ groupBy, topGroups, sort, withinGroupSort, groupedDocsToCollect, needScores, needScores, false
);
if (totalCount == TotalCount.grouped) {
@@ -776,7 +776,7 @@ public class Grouping {
*/
@Override
public AbstractAllGroupHeadsCollector<?> createAllGroupCollector() throws IOException {
- Sort sortWithinGroup = groupSort != null ? groupSort : new Sort();
+ Sort sortWithinGroup = withinGroupSort != null ? withinGroupSort : new Sort();
return TermAllGroupHeadsCollector.create(groupBy, sortWithinGroup);
}
@@ -875,7 +875,7 @@ public class Grouping {
@Override
protected Collector createFirstPassCollector() throws IOException {
DocSet groupFilt = searcher.getDocSet(query);
- topCollector = newCollector(groupSort, needScores);
+ topCollector = newCollector(withinGroupSort, needScores);
collector = new FilterCollector(groupFilt, topCollector);
return collector;
}
@@ -980,7 +980,7 @@ public class Grouping {
int groupdDocsToCollect = getMax(groupOffset, docsPerGroup, maxDoc);
groupdDocsToCollect = Math.max(groupdDocsToCollect, 1);
secondPass = new FunctionSecondPassGroupingCollector(
- topGroups, sort, groupSort, groupdDocsToCollect, needScores, needScores, false, groupBy, context
+ topGroups, sort, withinGroupSort, groupdDocsToCollect, needScores, needScores, false, groupBy, context
);
if (totalCount == TotalCount.grouped) {
@@ -993,7 +993,7 @@ public class Grouping {
@Override
public AbstractAllGroupHeadsCollector<?> createAllGroupCollector() throws IOException {
- Sort sortWithinGroup = groupSort != null ? groupSort : new Sort();
+ Sort sortWithinGroup = withinGroupSort != null ? withinGroupSort : new Sort();
return new FunctionAllGroupHeadsCollector(groupBy, context, sortWithinGroup);
}