-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Bug fixes and refactoring 1. Shallow clone SearchResponse in SearchActionFilter. The only properties that we're currently changing are SearchHit and timeTookMillis. This is also less brittle as we don't try to implement deserialization ourselves. 2. KendraIntelligentRanker doesn't transform if the required client settings (endpoint + execution plan ID) are missing. 3. A lot of refactoring to prepare for other transformers. Where we previously had logic of the form `if kendra_intelligent_ranking then do Kendra intelligent ranking`, now the APIs support arbitrary named transformers. This required updates to tests and configuration code. 4. Added tests and fixes for SearchConfigurationExtBuilder. Signed-off-by: Michael Froh <froh@amazon.com> * Address PR comments from myself Looking at the PR on GitHub, I spotted a few mistakes and possible improvements. Signed-off-by: Michael Froh <froh@amazon.com> * Address comments by noCharger Signed-off-by: Michael Froh <froh@amazon.com> Signed-off-by: Michael Froh <froh@amazon.com> (cherry picked from commit d8ba75b) Co-authored-by: msfroh <froh@amazon.com>
- Loading branch information
1 parent
8bc45d2
commit 0f25ddd
Showing
17 changed files
with
611 additions
and
353 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
42 changes: 42 additions & 0 deletions
42
.../org/opensearch/search/relevance/configuration/ResultTransformerConfigurationFactory.java
This file contains 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,42 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.search.relevance.configuration; | ||
|
||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.common.xcontent.XContentParser; | ||
|
||
import java.io.IOException; | ||
|
||
public interface ResultTransformerConfigurationFactory { | ||
String getName(); | ||
|
||
/** | ||
* Build configuration based on index settings | ||
* @param indexSettings a set of index settings under a group scoped based on this result transformer's name. | ||
* @return a transformer configuration based on the passed settings. | ||
*/ | ||
ResultTransformerConfiguration configure(Settings indexSettings); | ||
|
||
/** | ||
* Build configuration from serialized XContent, e.g. as part of a serialized {@link SearchConfigurationExtBuilder}. | ||
* @param parser an XContentParser pointing to a node serialized from a {@link ResultTransformerConfiguration} of | ||
* this type. | ||
* @return a transformer configuration based on the parameters specified in the XContent. | ||
*/ | ||
ResultTransformerConfiguration configure(XContentParser parser) throws IOException; | ||
|
||
/** | ||
* Build configuration from a serialized stream. | ||
* @param streamInput a {@link org.opensearch.common.io.stream.Writeable} serialized representation of transformer | ||
* configuration. | ||
* @return configuration the deserialized transformer configuration. | ||
*/ | ||
ResultTransformerConfiguration configure(StreamInput streamInput) throws IOException; | ||
|
||
} |
Oops, something went wrong.