dsmiley commented on code in PR #3418:
URL: https://github.com/apache/solr/pull/3418#discussion_r2196062773
##########
solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java:
##########
@@ -1234,6 +1230,34 @@ protected void mergeIds(ResponseBuilder rb, ShardRequest
sreq) {
}
}
+ /**
+ * Creates a map of shard results based on the provided parameters.
+ *
+ * @param rb ResponseBuilder to retrieve any request info
+ * @param resultSize the desired size of the result map
+ * @param queue the queue containing sorted hits from different shards
+ * @param shardDocMap a map of shard documents indexed by shard ID
+ * @param responseDocs the final SolrDocumentList to be returned or set in
the responseBuilder
+ * @return a map of shard documents, where the keys are the shard IDs as
strings, and the values
+ * are the corresponding ShardDoc objects
+ */
+ protected Map<Object, ShardDoc> createShardResult(
Review Comment:
Shouldn't the key be a String and not an Object?
##########
solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java:
##########
@@ -1234,6 +1230,34 @@ protected void mergeIds(ResponseBuilder rb, ShardRequest
sreq) {
}
}
+ /**
+ * Creates a map of shard results based on the provided parameters.
+ *
+ * @param rb ResponseBuilder to retrieve any request info
+ * @param resultSize the desired size of the result map
+ * @param queue the queue containing sorted hits from different shards
+ * @param shardDocMap a map of shard documents indexed by shard ID
+ * @param responseDocs the final SolrDocumentList to be returned or set in
the responseBuilder
+ * @return a map of shard documents, where the keys are the shard IDs as
strings, and the values
+ * are the corresponding ShardDoc objects
+ */
+ protected Map<Object, ShardDoc> createShardResult(
+ ResponseBuilder rb,
+ int resultSize,
+ ShardFieldSortedHitQueue queue,
+ Map<String, List<ShardDoc>> shardDocMap,
+ SolrDocumentList responseDocs) {
+ Map<Object, ShardDoc> resultIds = new HashMap<>();
Review Comment:
See `org.apache.solr.common.util.CollectionUtil#newHashMap` and pre-size
##########
solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java:
##########
@@ -240,7 +241,7 @@ public void changed(SolrPackageLoader.SolrPackage pkg, Ctx
ctx) {
}
@SuppressWarnings({"unchecked"})
- private void initComponents() {
+ private void initComponents(boolean isCombinedQuery) {
Review Comment:
Strongly agree with the smell!
##########
solr/core/src/java/org/apache/solr/search/combine/QueryAndResponseCombiner.java:
##########
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.search.combine;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import org.apache.lucene.search.Explanation;
+import org.apache.lucene.search.Query;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.params.CombinerParams;
+import org.apache.solr.common.params.SolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.handler.component.ShardDoc;
+import org.apache.solr.schema.IndexSchema;
+import org.apache.solr.search.DocList;
+import org.apache.solr.search.QueryResult;
+import org.apache.solr.search.SolrIndexSearcher;
+
+/**
+ * The QueryAndResponseCombiner class is an abstract base class for combining
query results and
+ * responses. It provides a framework for different algorithms to be
implemented for merging ranked
Review Comment:
results & responses -- seem synonymous to me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]