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

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1709230 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christine Poerschke 2015-10-18 04:52:14 +00:00
parent fabb90d1d3
commit 64c73ef6a2
4 changed files with 19 additions and 17 deletions

View File

@ -118,6 +118,8 @@ Other Changes
* SOLR-8132: HDFSDirectoryFactory now defaults to using the global block cache. (Mark Miller) * 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 ================== ================== 5.4.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

View File

@ -461,7 +461,7 @@ public class QueryComponent extends SearchComponent
Grouping grouping = Grouping grouping =
new Grouping(searcher, result, cmd, cacheSecondPassSearch, maxDocsPercentageToCache, groupingSpec.isMain()); new Grouping(searcher, result, cmd, cacheSecondPassSearch, maxDocsPercentageToCache, groupingSpec.isMain());
grouping.setSort(groupingSpec.getGroupSort()) grouping.setSort(groupingSpec.getGroupSort())
.setGroupSort(groupingSpec.getSortWithinGroup()) .setWithinGroupSort(groupingSpec.getSortWithinGroup())
.setDefaultFormat(groupingSpec.getResponseFormat()) .setDefaultFormat(groupingSpec.getResponseFormat())
.setLimitDefault(limitDefault) .setLimitDefault(limitDefault)
.setDefaultTotalCount(defaultTotalCount) .setDefaultTotalCount(defaultTotalCount)

View File

@ -268,7 +268,7 @@ public class SimpleFacets {
DocSet base = searcher.getDocSet(qlist); DocSet base = searcher.getDocSet(qlist);
if (rb.grouping() && rb.getGroupingSpec().isTruncateGroups()) { if (rb.grouping() && rb.getGroupingSpec().isTruncateGroups()) {
Grouping grouping = new Grouping(searcher, null, rb.getQueryCommand(), false, 0, false); 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) { if (rb.getGroupingSpec().getFields().length > 0) {
grouping.addFieldCommand(rb.getGroupingSpec().getFields()[0], req); grouping.addFieldCommand(rb.getGroupingSpec().getFields()[0], req);
} else if (rb.getGroupingSpec().getFunctions().length > 0) { } else if (rb.getGroupingSpec().getFunctions().length > 0) {

View File

@ -91,7 +91,7 @@ public class Grouping {
private final int maxDocsPercentageToCache; private final int maxDocsPercentageToCache;
private Sort sort; private Sort sort;
private Sort groupSort; private Sort withinGroupSort;
private int limitDefault; private int limitDefault;
private int docsPerGroupDefault; private int docsPerGroupDefault;
private int groupOffsetDefault; private int groupOffsetDefault;
@ -158,7 +158,7 @@ public class Grouping {
} }
Grouping.CommandField gc = new CommandField(); Grouping.CommandField gc = new CommandField();
gc.groupSort = groupSort; gc.withinGroupSort = withinGroupSort;
gc.groupBy = field; gc.groupBy = field;
gc.key = field; gc.key = field;
gc.numGroups = limitDefault; gc.numGroups = limitDefault;
@ -201,7 +201,7 @@ public class Grouping {
commandFunc.groupBy = new QueryValueSource(q, 0.0f); commandFunc.groupBy = new QueryValueSource(q, 0.0f);
gc = commandFunc; gc = commandFunc;
} }
gc.groupSort = groupSort; gc.withinGroupSort = withinGroupSort;
gc.key = groupByStr; gc.key = groupByStr;
gc.numGroups = limitDefault; gc.numGroups = limitDefault;
gc.docsPerGroup = docsPerGroupDefault; gc.docsPerGroup = docsPerGroupDefault;
@ -228,7 +228,7 @@ public class Grouping {
Query gq = parser.getQuery(); Query gq = parser.getQuery();
Grouping.CommandQuery gc = new CommandQuery(); Grouping.CommandQuery gc = new CommandQuery();
gc.query = gq; gc.query = gq;
gc.groupSort = groupSort; gc.withinGroupSort = withinGroupSort;
gc.key = groupByStr; gc.key = groupByStr;
gc.numGroups = limitDefault; gc.numGroups = limitDefault;
gc.docsPerGroup = docsPerGroupDefault; gc.docsPerGroup = docsPerGroupDefault;
@ -256,8 +256,8 @@ public class Grouping {
return this; return this;
} }
public Grouping setGroupSort(Sort groupSort) { public Grouping setWithinGroupSort(Sort withinGroupSort) {
this.groupSort = groupSort; this.withinGroupSort = withinGroupSort;
return this; return this;
} }
@ -309,12 +309,12 @@ public class Grouping {
needScores = (cmd.getFlags() & SolrIndexSearcher.GET_SCORES) != 0; needScores = (cmd.getFlags() & SolrIndexSearcher.GET_SCORES) != 0;
boolean cacheScores = false; 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 (!needScores && !commands.isEmpty()) {
if (commands.get(0).groupSort == null) { if (commands.get(0).withinGroupSort == null) {
cacheScores = true; cacheScores = true;
} else { } else {
for (SortField field : commands.get(0).groupSort.getSort()) { for (SortField field : commands.get(0).withinGroupSort.getSort()) {
if (field.getType() == SortField.Type.SCORE) { if (field.getType() == SortField.Type.SCORE) {
cacheScores = true; cacheScores = true;
break; break;
@ -525,7 +525,7 @@ public class Grouping {
public abstract class Command<GROUP_VALUE_TYPE> { public abstract class Command<GROUP_VALUE_TYPE> {
public String key; // the name to use for this group in the response 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 Sort sort; // the sort between groups
public int docsPerGroup; // how many docs in each group - from "group.limit" param, default=1 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) 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); int groupedDocsToCollect = getMax(groupOffset, docsPerGroup, maxDoc);
groupedDocsToCollect = Math.max(groupedDocsToCollect, 1); groupedDocsToCollect = Math.max(groupedDocsToCollect, 1);
secondPass = new TermSecondPassGroupingCollector( secondPass = new TermSecondPassGroupingCollector(
groupBy, topGroups, sort, groupSort, groupedDocsToCollect, needScores, needScores, false groupBy, topGroups, sort, withinGroupSort, groupedDocsToCollect, needScores, needScores, false
); );
if (totalCount == TotalCount.grouped) { if (totalCount == TotalCount.grouped) {
@ -776,7 +776,7 @@ public class Grouping {
*/ */
@Override @Override
public AbstractAllGroupHeadsCollector<?> createAllGroupCollector() throws IOException { public AbstractAllGroupHeadsCollector<?> createAllGroupCollector() throws IOException {
Sort sortWithinGroup = groupSort != null ? groupSort : new Sort(); Sort sortWithinGroup = withinGroupSort != null ? withinGroupSort : new Sort();
return TermAllGroupHeadsCollector.create(groupBy, sortWithinGroup); return TermAllGroupHeadsCollector.create(groupBy, sortWithinGroup);
} }
@ -875,7 +875,7 @@ public class Grouping {
@Override @Override
protected Collector createFirstPassCollector() throws IOException { protected Collector createFirstPassCollector() throws IOException {
DocSet groupFilt = searcher.getDocSet(query); DocSet groupFilt = searcher.getDocSet(query);
topCollector = newCollector(groupSort, needScores); topCollector = newCollector(withinGroupSort, needScores);
collector = new FilterCollector(groupFilt, topCollector); collector = new FilterCollector(groupFilt, topCollector);
return collector; return collector;
} }
@ -980,7 +980,7 @@ public class Grouping {
int groupdDocsToCollect = getMax(groupOffset, docsPerGroup, maxDoc); int groupdDocsToCollect = getMax(groupOffset, docsPerGroup, maxDoc);
groupdDocsToCollect = Math.max(groupdDocsToCollect, 1); groupdDocsToCollect = Math.max(groupdDocsToCollect, 1);
secondPass = new FunctionSecondPassGroupingCollector( 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) { if (totalCount == TotalCount.grouped) {
@ -993,7 +993,7 @@ public class Grouping {
@Override @Override
public AbstractAllGroupHeadsCollector<?> createAllGroupCollector() throws IOException { 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); return new FunctionAllGroupHeadsCollector(groupBy, context, sortWithinGroup);
} }