You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2021/03/26 18:55:20 UTC
[lucene-solr] branch branch_8x updated: SOLR-15273: Distributed
Group Query supports rename unique key field name (#35)
This is an automated email from the ASF dual-hosted git repository.
cpoerschke pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new c83f321 SOLR-15273: Distributed Group Query supports rename unique key field name (#35)
c83f321 is described below
commit c83f321fd22dd67f6dbf420cf4ddcb562ae83897
Author: limingnihao <li...@live.com>
AuthorDate: Sat Mar 27 02:39:46 2021 +0800
SOLR-15273: Distributed Group Query supports rename unique key field name (#35)
* SOLR-15273: Distributed Group Query supports rename unique key field name
* SOLR-15273: add CHANGES.txt
* solr/CHANGES.txt edit
picked 'field name alias' and 'result grouping' terminology from Solr Reference Guide:
* https://solr.apache.org/guide/8_8/common-query-parameters.html#field-name-aliases
* https://solr.apache.org/guide/8_8/result-grouping.html
included NullPointerException and StoredFieldsShardResponseProcessor since users would encounter those when encountering the issue being fixed here
Co-authored-by: shiming.li <sh...@zhaopin.com.cn>
Co-authored-by: Christine Poerschke <cp...@apache.org>
Resolved Conflicts:
solr/CHANGES.txt
---
solr/CHANGES.txt | 3 +++
.../responseprocessor/StoredFieldsShardResponseProcessor.java | 4 ++++
solr/core/src/test/org/apache/solr/TestDistributedGrouping.java | 3 +++
3 files changed, 10 insertions(+)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 82fde99..6ab85e7 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -70,6 +70,9 @@ Bug Fixes
* SOLR-15249: Properly set ZK ACLs on /security.json (Mike Drob)
+* SOLR-15273: Fix NullPointerException in StoredFieldsShardResponseProcessor that happened when a field name alias is
+ used for the unique key field in searches with distributed result grouping. (limingnihao via Christine Poerschke)
+
Other Changes
---------------------
* SOLR-15118: Deprecate CollectionAdminRequest.getV2Request(). (Jason Gerlowski)
diff --git a/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/StoredFieldsShardResponseProcessor.java b/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/StoredFieldsShardResponseProcessor.java
index 734a0e0..019aca1 100644
--- a/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/StoredFieldsShardResponseProcessor.java
+++ b/solr/core/src/java/org/apache/solr/search/grouping/distributed/responseprocessor/StoredFieldsShardResponseProcessor.java
@@ -38,6 +38,10 @@ public class StoredFieldsShardResponseProcessor implements ShardResponseProcesso
SolrDocumentList docs = (SolrDocumentList)srsp.getSolrResponse().getResponse().get("response");
String uniqueIdFieldName = rb.req.getSchema().getUniqueKeyField().getName();
+ if (rb.rsp.getReturnFields().getFieldRenames().get(uniqueIdFieldName) != null) {
+ // if id was renamed we need to use the new name
+ uniqueIdFieldName = rb.rsp.getReturnFields().getFieldRenames().get(uniqueIdFieldName);
+ }
for (SolrDocument doc : docs) {
Object id = doc.getFieldValue(uniqueIdFieldName).toString();
ShardDoc shardDoc = rb.resultIds.get(id);
diff --git a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java
index 11220e4..0ed36fd 100644
--- a/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java
+++ b/solr/core/src/test/org/apache/solr/TestDistributedGrouping.java
@@ -286,6 +286,9 @@ public class TestDistributedGrouping extends BaseDistributedSearchTestCase {
query("q", "*:*", "fq", s1 + ":a", "fl", "id," + i1, "group", "true", "group.field", i1, "sort", i1 + " asc, id asc", "group.ngroups", "true");
query("q", "*:*", "fq", s1 + ":a", "rows", 0, "fl", "id," + i1, "group", "true", "group.field", i1, "sort", i1 + " asc, id asc", "group.ngroups", "true");
+ // SOLR-15273: if id was renamed we need to use the new name
+ query("q", "*:*", "rows", 100, "fl", "aliasId:id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc");
+
// SOLR-3960 - include a postfilter
for (String facet : new String[] { "false", "true"}) {
for (String fcache : new String[] { "", " cache=false cost=200"}) {