mirror of https://github.com/apache/lucene.git
SOLR-13496: Fix distributed grouping related NullPointerException in JSONWriter.writeSolrDocument
This commit is contained in:
parent
cd030efa9c
commit
1710a8a36d
|
@ -92,6 +92,8 @@ Bug Fixes
|
|||
* SOLR-13521: Fix input parameter handling in SchemaRequest.DynamicField and SchemaRequest.FieldTypes (Schema API)
|
||||
(Tomás Fernández Löbbe)
|
||||
|
||||
* SOLR-13496: Fix distributed grouping related NullPointerException in JSONWriter.writeSolrDocument (Christine Poerschke)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.lucene.search.TotalHits;
|
|||
import org.apache.lucene.search.grouping.GroupDocs;
|
||||
import org.apache.lucene.search.grouping.TopGroups;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.solr.common.SolrDocument;
|
||||
import org.apache.solr.common.SolrDocumentList;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.SolrException.ErrorCode;
|
||||
|
@ -90,9 +91,7 @@ public class GroupedEndResultTransformer implements EndResultTransformer {
|
|||
docList.setMaxScore(group.maxScore);
|
||||
}
|
||||
docList.setStart(rb.getGroupingSpec().getWithinGroupOffset());
|
||||
for (ScoreDoc scoreDoc : group.scoreDocs) {
|
||||
docList.add(solrDocumentSource.retrieve(scoreDoc));
|
||||
}
|
||||
retrieveAndAdd(docList, solrDocumentSource, group.scoreDocs);
|
||||
groupResult.add("doclist", docList);
|
||||
groups.add(groupResult);
|
||||
}
|
||||
|
@ -110,9 +109,7 @@ public class GroupedEndResultTransformer implements EndResultTransformer {
|
|||
docList.setMaxScore(queryCommandResult.getMaxScore());
|
||||
}
|
||||
docList.setStart(rb.getGroupingSpec().getWithinGroupOffset());
|
||||
for (ScoreDoc scoreDoc :queryCommandResult.getTopDocs().scoreDocs){
|
||||
docList.add(solrDocumentSource.retrieve(scoreDoc));
|
||||
}
|
||||
retrieveAndAdd(docList, solrDocumentSource, queryCommandResult.getTopDocs().scoreDocs);
|
||||
command.add("doclist", docList);
|
||||
commands.add(entry.getKey(), command);
|
||||
}
|
||||
|
@ -120,4 +117,13 @@ public class GroupedEndResultTransformer implements EndResultTransformer {
|
|||
rb.rsp.add("grouped", commands);
|
||||
}
|
||||
|
||||
private static void retrieveAndAdd(SolrDocumentList solrDocumentList, SolrDocumentSource solrDocumentSource, ScoreDoc[] scoreDocs) {
|
||||
for (ScoreDoc scoreDoc : scoreDocs) {
|
||||
SolrDocument solrDocument = solrDocumentSource.retrieve(scoreDoc);
|
||||
if (solrDocument != null) {
|
||||
solrDocumentList.add(solrDocument);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue