-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into metafields-index-service
Signed-off-by: Craig Perkins <[email protected]>
- Loading branch information
Showing
12 changed files
with
240 additions
and
20 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
21 changes: 21 additions & 0 deletions
21
.../org/opensearch/common/annotation/processor/PublicApiConstructorAnnotatedInternalApi.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,21 @@ | ||
/* | ||
* 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.common.annotation.processor; | ||
|
||
import org.opensearch.common.annotation.InternalApi; | ||
import org.opensearch.common.annotation.PublicApi; | ||
|
||
@PublicApi(since = "1.0.0") | ||
public class PublicApiConstructorAnnotatedInternalApi { | ||
/** | ||
* The constructors have relaxed semantics at the moment: those could be not annotated or be annotated as {@link InternalApi} | ||
*/ | ||
@InternalApi | ||
public PublicApiConstructorAnnotatedInternalApi(NotAnnotated arg) {} | ||
} |
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
106 changes: 106 additions & 0 deletions
106
...est/java/org/opensearch/search/pipeline/common/SearchPipelineCommonModulePluginTests.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,106 @@ | ||
/* | ||
* 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.pipeline.common; | ||
|
||
import org.opensearch.common.settings.Settings; | ||
import org.opensearch.env.TestEnvironment; | ||
import org.opensearch.plugins.SearchPipelinePlugin; | ||
import org.opensearch.test.OpenSearchTestCase; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.function.BiFunction; | ||
|
||
public class SearchPipelineCommonModulePluginTests extends OpenSearchTestCase { | ||
|
||
public void testRequestProcessorAllowlist() throws IOException { | ||
final String key = SearchPipelineCommonModulePlugin.REQUEST_PROCESSORS_ALLOWLIST_SETTING.getKey(); | ||
runAllowlistTest(key, List.of(), SearchPipelineCommonModulePlugin::getRequestProcessors); | ||
runAllowlistTest(key, List.of("filter_query"), SearchPipelineCommonModulePlugin::getRequestProcessors); | ||
runAllowlistTest(key, List.of("script"), SearchPipelineCommonModulePlugin::getRequestProcessors); | ||
runAllowlistTest(key, List.of("oversample", "script"), SearchPipelineCommonModulePlugin::getRequestProcessors); | ||
runAllowlistTest(key, List.of("filter_query", "script", "oversample"), SearchPipelineCommonModulePlugin::getRequestProcessors); | ||
|
||
final IllegalArgumentException e = expectThrows( | ||
IllegalArgumentException.class, | ||
() -> runAllowlistTest(key, List.of("foo"), SearchPipelineCommonModulePlugin::getRequestProcessors) | ||
); | ||
assertTrue(e.getMessage(), e.getMessage().contains("foo")); | ||
} | ||
|
||
public void testResponseProcessorAllowlist() throws IOException { | ||
final String key = SearchPipelineCommonModulePlugin.RESPONSE_PROCESSORS_ALLOWLIST_SETTING.getKey(); | ||
runAllowlistTest(key, List.of(), SearchPipelineCommonModulePlugin::getResponseProcessors); | ||
runAllowlistTest(key, List.of("rename_field"), SearchPipelineCommonModulePlugin::getResponseProcessors); | ||
runAllowlistTest(key, List.of("truncate_hits"), SearchPipelineCommonModulePlugin::getResponseProcessors); | ||
runAllowlistTest(key, List.of("collapse", "truncate_hits"), SearchPipelineCommonModulePlugin::getResponseProcessors); | ||
runAllowlistTest( | ||
key, | ||
List.of("rename_field", "truncate_hits", "collapse"), | ||
SearchPipelineCommonModulePlugin::getResponseProcessors | ||
); | ||
|
||
final IllegalArgumentException e = expectThrows( | ||
IllegalArgumentException.class, | ||
() -> runAllowlistTest(key, List.of("foo"), SearchPipelineCommonModulePlugin::getResponseProcessors) | ||
); | ||
assertTrue(e.getMessage(), e.getMessage().contains("foo")); | ||
} | ||
|
||
public void testSearchPhaseResultsProcessorAllowlist() throws IOException { | ||
final String key = SearchPipelineCommonModulePlugin.SEARCH_PHASE_RESULTS_PROCESSORS_ALLOWLIST_SETTING.getKey(); | ||
runAllowlistTest(key, List.of(), SearchPipelineCommonModulePlugin::getSearchPhaseResultsProcessors); | ||
|
||
final IllegalArgumentException e = expectThrows( | ||
IllegalArgumentException.class, | ||
() -> runAllowlistTest(key, List.of("foo"), SearchPipelineCommonModulePlugin::getSearchPhaseResultsProcessors) | ||
); | ||
assertTrue(e.getMessage(), e.getMessage().contains("foo")); | ||
} | ||
|
||
private void runAllowlistTest( | ||
String settingKey, | ||
List<String> allowlist, | ||
BiFunction<SearchPipelineCommonModulePlugin, SearchPipelinePlugin.Parameters, Map<String, ?>> function | ||
) throws IOException { | ||
final Settings settings = Settings.builder().putList(settingKey, allowlist).build(); | ||
try (SearchPipelineCommonModulePlugin plugin = new SearchPipelineCommonModulePlugin()) { | ||
assertEquals(Set.copyOf(allowlist), function.apply(plugin, createParameters(settings)).keySet()); | ||
} | ||
} | ||
|
||
public void testAllowlistNotSpecified() throws IOException { | ||
final Settings settings = Settings.EMPTY; | ||
try (SearchPipelineCommonModulePlugin plugin = new SearchPipelineCommonModulePlugin()) { | ||
assertEquals(Set.of("oversample", "filter_query", "script"), plugin.getRequestProcessors(createParameters(settings)).keySet()); | ||
assertEquals( | ||
Set.of("rename_field", "truncate_hits", "collapse"), | ||
plugin.getResponseProcessors(createParameters(settings)).keySet() | ||
); | ||
assertEquals(Set.of(), plugin.getSearchPhaseResultsProcessors(createParameters(settings)).keySet()); | ||
} | ||
} | ||
|
||
private static SearchPipelinePlugin.Parameters createParameters(Settings settings) { | ||
return new SearchPipelinePlugin.Parameters( | ||
TestEnvironment.newEnvironment(Settings.builder().put(settings).put("path.home", "").build()), | ||
null, | ||
null, | ||
null, | ||
() -> 0L, | ||
(a, b) -> null, | ||
null, | ||
null, | ||
$ -> {}, | ||
null | ||
); | ||
} | ||
} |
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
1 change: 0 additions & 1 deletion
1
plugins/repository-azure/licenses/azure-storage-common-12.21.2.jar.sha1
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
plugins/repository-azure/licenses/azure-storage-common-12.25.1.jar.sha1
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 @@ | ||
96e2df76ce9a8fa084ae289bb59295d565f2b8d5 |
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