mirror of https://github.com/apache/lucene.git
SOLR-8555: SearchGroupShardResponseProcessor (initialCapacity) tweaks
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1724787 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a9ea61f905
commit
d804cc620d
|
@ -527,6 +527,8 @@ Other Changes
|
||||||
* SOLR-8549: Solr start script checks for cores which have failed to load as well before attempting to
|
* SOLR-8549: Solr start script checks for cores which have failed to load as well before attempting to
|
||||||
create a core with the same name (Varun Thacker)
|
create a core with the same name (Varun Thacker)
|
||||||
|
|
||||||
|
* SOLR-8555: SearchGroupShardResponseProcessor (initialCapacity) tweaks (Christine Poerschke)
|
||||||
|
|
||||||
================== 5.4.1 ==================
|
================== 5.4.1 ==================
|
||||||
|
|
||||||
Bug Fixes
|
Bug Fixes
|
||||||
|
|
|
@ -51,14 +51,14 @@ public class SearchGroupShardResponseProcessor implements ShardResponseProcessor
|
||||||
public void process(ResponseBuilder rb, ShardRequest shardRequest) {
|
public void process(ResponseBuilder rb, ShardRequest shardRequest) {
|
||||||
SortSpec ss = rb.getSortSpec();
|
SortSpec ss = rb.getSortSpec();
|
||||||
Sort groupSort = rb.getGroupingSpec().getGroupSort();
|
Sort groupSort = rb.getGroupingSpec().getGroupSort();
|
||||||
String[] fields = rb.getGroupingSpec().getFields();
|
final String[] fields = rb.getGroupingSpec().getFields();
|
||||||
Sort sortWithinGroup = rb.getGroupingSpec().getSortWithinGroup();
|
Sort sortWithinGroup = rb.getGroupingSpec().getSortWithinGroup();
|
||||||
if (sortWithinGroup == null) { // TODO prevent it from being null in the first place
|
if (sortWithinGroup == null) { // TODO prevent it from being null in the first place
|
||||||
sortWithinGroup = Sort.RELEVANCE;
|
sortWithinGroup = Sort.RELEVANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, List<Collection<SearchGroup<BytesRef>>>> commandSearchGroups = new HashMap<>();
|
final Map<String, List<Collection<SearchGroup<BytesRef>>>> commandSearchGroups = new HashMap<>(fields.length, 1.0f);
|
||||||
Map<String, Map<SearchGroup<BytesRef>, Set<String>>> tempSearchGroupToShards = new HashMap<>();
|
final Map<String, Map<SearchGroup<BytesRef>, Set<String>>> tempSearchGroupToShards = new HashMap<>(fields.length, 1.0f);
|
||||||
for (String field : fields) {
|
for (String field : fields) {
|
||||||
commandSearchGroups.put(field, new ArrayList<Collection<SearchGroup<BytesRef>>>(shardRequest.responses.size()));
|
commandSearchGroups.put(field, new ArrayList<Collection<SearchGroup<BytesRef>>>(shardRequest.responses.size()));
|
||||||
tempSearchGroupToShards.put(field, new HashMap<SearchGroup<BytesRef>, Set<String>>());
|
tempSearchGroupToShards.put(field, new HashMap<SearchGroup<BytesRef>, Set<String>>());
|
||||||
|
@ -74,13 +74,13 @@ public class SearchGroupShardResponseProcessor implements ShardResponseProcessor
|
||||||
|
|
||||||
NamedList<Object> shardInfo = null;
|
NamedList<Object> shardInfo = null;
|
||||||
if (rb.req.getParams().getBool(ShardParams.SHARDS_INFO, false)) {
|
if (rb.req.getParams().getBool(ShardParams.SHARDS_INFO, false)) {
|
||||||
shardInfo = new SimpleOrderedMap<>();
|
shardInfo = new SimpleOrderedMap<>(shardRequest.responses.size());
|
||||||
rb.rsp.getValues().add(ShardParams.SHARDS_INFO + ".firstPhase", shardInfo);
|
rb.rsp.getValues().add(ShardParams.SHARDS_INFO + ".firstPhase", shardInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ShardResponse srsp : shardRequest.responses) {
|
for (ShardResponse srsp : shardRequest.responses) {
|
||||||
if (shardInfo != null) {
|
if (shardInfo != null) {
|
||||||
SimpleOrderedMap<Object> nl = new SimpleOrderedMap<>();
|
SimpleOrderedMap<Object> nl = new SimpleOrderedMap<>(4);
|
||||||
|
|
||||||
if (srsp.getException() != null) {
|
if (srsp.getException() != null) {
|
||||||
Throwable t = srsp.getException();
|
Throwable t = srsp.getException();
|
||||||
|
|
Loading…
Reference in New Issue