ercsonusharma commented on code in PR #4144: URL: https://github.com/apache/solr/pull/4144#discussion_r2825811021
########## solr/solr-ref-guide/modules/query-guide/pages/json-combined-query-dsl.adoc: ########## @@ -71,37 +108,41 @@ Below is a sample JSON query payload: } ``` -== Search Handler Configuration - -Combined Query Feature has a separate handler with class `solr.CombinedQuerySearchHandler` which can be configured as below: - -``` -<requestHandler name="/search" class="solr.CombinedQuerySearchHandler"> -..... -</requestHandler> -``` +== Combiner Algorithm Plugin -The Search Handler also accepts parameters as below: +As mentioned xref:json-combined-query-dsl.adoc#query-dsl-structure[above], custom algorithms can be configured to combine the results across multiple queries using a https://solr.apache.org/guide/solr/latest/configuration-guide/solr-plugins.html[Solr plugin]. -`maxCombinerQueries`:: - This parameter can be set to put upper limit check on the maximum number of queries can be executed defined in `combiner.query`. - It defaults to `5` if not set. +The class to implement the custom logic has to extend `QueryAndResponseCombiner`, which is an abstract base class that provides a framework for implementing various algorithms used to merge ranked lists and shard documents. -=== Combiner Algorithm Plugin +The custom class must be implemented in a Java project built against the Solr version that includes this feature (declared as a dependency in the build configuration), and the compiled JAR must then be deployed to the Solr libraries directory `../server/solr-webapp/webapp/WEB-INF/lib`. -As mentioned xref:json-combined-query-dsl.adoc#query-dsl-structure[above], custom algorithms can be configured to combine the results across multiple queries. -The Combined Query Search Handler definition takes parameter `combiners` where a custom class can be used to define the algorithm by giving a name and the parameters required. +The Combined Query Component definition takes the `combiners` parameter, where the custom class can be declared by specifying a name and the custom parameters required by the custom algorithm. -Example of the Search Handler as below: +Example of the Search Component as below: ``` <searchComponent class="solr.CombinedQueryComponent" name="combined_query"> - <int name="maxCombinerQueries">2</int> + <int name="maxCombinerQueries">2</int> <lst name="combiners"> - <lst name="customAlgorithm"> - <str name="class">org.apache.solr.search.combine.CustomCombiner</str> - <int name="var1">35</int> - <str name="var2">customValue</str> + <lst name="customAlgorithm"> + <str name="class">org.apache.solr.handler.component.combine.CustomCombiner</str> + <int name="customParam1">35</int> + <str name="customParam2">customValue</str> </lst> </lst> - </searchComponent> +</searchComponent> +``` + +Then, when executing the combined query, the only thing that changes in the JSON query payload is the value specified in the `combiner.algorithm` parameter: Review Comment: I appreciate you breaking this down. -- 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]
