SOLR-13404: Fix NPE when group=true and no group.field is present

* This was introduced in SOLR-12249
This commit is contained in:
Munendra S N 2019-07-02 10:27:54 +05:30
parent cfd22cd493
commit 48b026d5ee
1 changed files with 7 additions and 4 deletions

View File

@ -286,10 +286,13 @@ public class QueryComponent extends SearchComponent
if (req.getCore().getCoreContainer().isZooKeeperAware()) {
IndexSchema schema = rb.req.getSchema();
String[] fields = params.getParams(GroupParams.GROUP_FIELD);
for (String field : fields) {
SchemaField schemaField = schema.getField(field);
if (schemaField.getType().isTokenized() && (schemaField.getType() instanceof SortableTextField) == false) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, String.format(Locale.ROOT, "Sorting on a tokenized field that is not a SortableTextField is not supported in cloud mode."));
if (fields != null) {
for (String field : fields) {
SchemaField schemaField = schema.getField(field);
if (schemaField.getType().isTokenized() && (schemaField.getType() instanceof SortableTextField) == false) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, String.format(Locale.ROOT,
"Sorting on a tokenized field that is not a SortableTextField is not supported in cloud mode."));
}
}
}
}