-
Notifications
You must be signed in to change notification settings - Fork 814
SOLR-17319 : Combined Query Feature for Multi Query Execution #3418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 67 commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
bf3cd5d
Combined Query Feature for Multi Query Execution
182bec9
Tests: Combined Query Feature for Multi Query Execution
b884f0e
Tests: Combined Query Feature for Multi Query Execution
29e8aea
Tests: Combined Query Feature for Multi Query Execution
c113799
Improve: Fix typo
ercsonusharma 3600ed3
Tests: Fix errors
ercsonusharma 9b0c76e
Review comments: implementation
ercsonusharma a841bc7
Code review changes
ercsonusharma 91f8e09
Code review changes
ercsonusharma cace1f7
Code review changes
ercsonusharma 299db43
Code review changes
ercsonusharma 840070e
Code review changes
ercsonusharma d2feefc
Improvement and fixes
ercsonusharma 89f63a9
Review comments impl
ercsonusharma d821abb
Build fix
ercsonusharma 8041d66
Added documentation
ercsonusharma 397dbb3
Fix for lucene upgrade
ercsonusharma d8b5588
Doc improv for cursors
ercsonusharma ec0b9cb
review comment implementation
ercsonusharma d6fd190
review comment implementation
ercsonusharma 86933bc
review comment implementation
ercsonusharma b164979
doc update
ercsonusharma 85f2cf9
added more test
ercsonusharma a4a26aa
abstract QueryComponent.mergeIds' ShardDoc processing
cpoerschke 7fe997c
add missing @Override annotations
cpoerschke bcd1c3b
make DefaultShardDocQueue an anonymous class
cpoerschke 787a016
Merge branch 'apache:main' into QueryComponent-mergeIds
cpoerschke 7e0727c
Merge remote-tracking branch 'github_cpoerschke/QueryComponent-mergeI…
cpoerschke 4dcbb57
dev increment: add uniqueDoc map-and-logic to ShardDocQueue
cpoerschke 8a65023
review comment fix
ercsonusharma 006b8c2
micro dev increment: replace unnecessary local resultSize use in Quer…
cpoerschke 771089b
dev increment: factor out ShardDocQueue.resultIds method
cpoerschke 460e8cd
dev increment: remove no-longer-used ShardDocQueue.(pop,size) methods
cpoerschke ac85d2f
review comment fix
ercsonusharma 7b0593c
review comment fix
ercsonusharma c03c0f7
review comment enhancement
ercsonusharma a52dd22
simplification/consolidation: protected QueryComponent.newShardDocQue…
cpoerschke 195f3f1
factor out protected QueryComponent.setResultIdsAndResponseDocs method
cpoerschke c1f5501
review comment enhancement
ercsonusharma 3649d3e
Merge branch 'feat_combined_query' of https://github.com/ercsonusharm…
ercsonusharma 4eedbed
refactor to reduce cyclometric complexity
ercsonusharma 0990e7f
review comment fixes
ercsonusharma 14ff5e1
debug params fix and rrf shard sort order
ercsonusharma bd637b7
test cases fix and rrf shard sort order
ercsonusharma 2958599
introducing combiner methods as pre and post
ercsonusharma c3e44c3
distrib forced and doc update
ercsonusharma e2dfcef
distrib forced fix
ercsonusharma d4b34fc
distrib forced fix
ercsonusharma 3fe93b8
test fix
ercsonusharma f23cceb
removing combiner.method and test fix
ercsonusharma 6419a07
test fix
ercsonusharma a560899
test fix
ercsonusharma ae84ef3
bug fix
ercsonusharma 1083fdd
review comment
ercsonusharma be428f0
added test case for solrcloud combined query
ercsonusharma 5b487c2
added test case for solrcloud combined query
ercsonusharma 18e8518
little refactoring
dsmiley f08f75e
test case modification
ercsonusharma 1ed538a
Merge branch 'feat_combined_query' of https://github.com/ercsonusharm…
ercsonusharma 2b7342b
test update
ercsonusharma aa0c23a
refactor and test cases for forceddistrib
ercsonusharma 4e0b536
Improve forcedDistrib stuff
dsmiley 6e6228b
Merge branch 'main' into fork/ercsonusharma/feat_combined_query
dsmiley 7604e94
Limit forceDistrib API surface area.
dsmiley ed0ad98
test fix for sort tie break
ercsonusharma 07ce63e
test ForcedDistribSearchHandler
dsmiley 1c76210
Merge branch 'main' of https://github.com/apache/solr into feat_combi…
ercsonusharma c560cd5
little clean up; fresh workflow trigger
ercsonusharma f7f48ff
update changelog
dsmiley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| title: New CombinedQuerySearchHandler etc. for implementing hybrid search with reciprocal rank fusion (RRF). Also included internal API for forcing distributed-search/coordinator. | ||
| type: added | ||
| authors: | ||
| - name: Sonu Sharma | ||
| - name: David Smiley | ||
| links: | ||
| - name: SOLR-17319 | ||
| url: https://issues.apache.org/jira/browse/SOLR-17319 |
614 changes: 614 additions & 0 deletions
614
solr/core/src/java/org/apache/solr/handler/component/CombinedQueryComponent.java
Large diffs are not rendered by default.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
solr/core/src/java/org/apache/solr/handler/component/CombinedQueryResponseBuilder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * 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.handler.component; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import org.apache.solr.request.SolrQueryRequest; | ||
| import org.apache.solr.response.SolrQueryResponse; | ||
|
|
||
| /** | ||
| * The CombinedQueryResponseBuilder class extends the ResponseBuilder class and is responsible for | ||
| * building a combined response for multiple SearchComponent objects. It orchestrates the process of | ||
| * constructing the SolrQueryResponse by aggregating results from various components. | ||
| */ | ||
| class CombinedQueryResponseBuilder extends ResponseBuilder { | ||
|
|
||
| final List<ResponseBuilder> responseBuilders = new ArrayList<>(); | ||
|
|
||
| CombinedQueryResponseBuilder( | ||
| SolrQueryRequest req, SolrQueryResponse rsp, List<SearchComponent> components) { | ||
| super(req, rsp, components); | ||
| } | ||
|
|
||
| /** | ||
| * Propagates all the properties from parent ResponseBuilder to the all the children which are | ||
| * being set later after the CombinedQueryComponent is prepared. | ||
| */ | ||
| final void propagate() { | ||
| responseBuilders.forEach( | ||
| thisRb -> { | ||
| thisRb.setNeedDocSet(isNeedDocSet()); | ||
| thisRb.setNeedDocList(isNeedDocList()); | ||
| thisRb.doFacets = doFacets; | ||
| thisRb.doHighlights = doHighlights; | ||
| thisRb.doExpand = doExpand; | ||
| thisRb.doTerms = doTerms; | ||
| thisRb.doStats = doStats; | ||
| thisRb.setDistribStatsDisabled(isDistribStatsDisabled()); | ||
| }); | ||
| } | ||
| } |
63 changes: 63 additions & 0 deletions
63
solr/core/src/java/org/apache/solr/handler/component/CombinedQuerySearchHandler.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * 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.handler.component; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import org.apache.solr.common.params.CombinerParams; | ||
| import org.apache.solr.request.SolrQueryRequest; | ||
| import org.apache.solr.response.SolrQueryResponse; | ||
|
|
||
| /** | ||
| * Extends the SearchHandler combining/fusing multiple queries (e.g. RRF) when the {@link | ||
| * CombinerParams#COMBINER} param is provided. If it isn't, does nothing special over SearchHandler. | ||
| * | ||
| * @see CombinedQueryComponent | ||
| */ | ||
| public class CombinedQuerySearchHandler extends SearchHandler { | ||
|
|
||
| /** Overrides to potentially return a custom {@link CombinedQueryResponseBuilder}. */ | ||
| @Override | ||
| protected ResponseBuilder newResponseBuilder( | ||
| SolrQueryRequest req, SolrQueryResponse rsp, List<SearchComponent> components) { | ||
| if (req.getParams().getBool(CombinerParams.COMBINER, false)) { | ||
| var rb = new CombinedQueryResponseBuilder(req, rsp, components); | ||
| // CombinedQueryComponent is only designed to work with distributed search. | ||
| rb.setForcedDistrib(true); | ||
| return rb; | ||
| } | ||
| return super.newResponseBuilder(req, rsp, components); | ||
| } | ||
|
|
||
| @Override | ||
| protected void postPrepareComponents(ResponseBuilder rb) { | ||
| super.postPrepareComponents(rb); | ||
| // propagate the CombinedQueryResponseBuilder's state to all subBuilders after prepare | ||
| if (rb instanceof CombinedQueryResponseBuilder crb) { | ||
| crb.propagate(); | ||
| } | ||
| } | ||
|
|
||
| /** Overrides the default list to include {@link CombinedQueryComponent}. */ | ||
| @Override | ||
| protected List<String> getDefaultComponents() { | ||
| List<String> names = new ArrayList<>(super.getDefaultComponents()); | ||
| String replaced = names.set(0, CombinedQueryComponent.COMPONENT_NAME); | ||
| assert replaced.equals(QueryComponent.COMPONENT_NAME); | ||
| return names; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.