From 458ce70a2774da5018ad8e20119d833c14686e69 Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Sat, 2 Nov 2024 12:46:07 -0700 Subject: [PATCH] synonym_analyzer configuration setting Signed-off-by: Prudhvi Godithi --- CHANGELOG.md | 1 + .../gradle/testclusters/OpenSearchNode.java | 46 +++++++++---------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edbf7c8ed065c..c875f440ad7f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Add Setting to adjust the primary constraint weights ([#16471](https://github.com/opensearch-project/OpenSearch/pull/16471)) - Switch from `buildSrc/version.properties` to Gradle version catalog (`gradle/libs.versions.toml`) to enable dependabot to perform automated upgrades on common libs ([#16284](https://github.com/opensearch-project/OpenSearch/pull/16284)) - Add dynamic setting allowing size > 0 requests to be cached in the request cache ([#16483](https://github.com/opensearch-project/OpenSearch/pull/16483/files)) +- Add new configuration setting `synonym_analyzer`, to the `synonym` and `synonym_graph` filters, enabling the specification of a custom analyzer for reading the synonym file ([#16488](https://github.com/opensearch-project/OpenSearch/pull/16488)). ### Dependencies - Bump `com.azure:azure-storage-common` from 12.25.1 to 12.27.1 ([#16521](https://github.com/opensearch-project/OpenSearch/pull/16521)) diff --git a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java index bb409c2afd871..950e66bdcdb0a 100644 --- a/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java +++ b/buildSrc/src/main/java/org/opensearch/gradle/testclusters/OpenSearchNode.java @@ -754,13 +754,13 @@ private Map getOpenSearchEnvironment() { if (systemProperties.isEmpty() == false) { systemPropertiesString = " " + systemProperties.entrySet() - .stream() - .map(entry -> "-D" + entry.getKey() + "=" + entry.getValue()) - // OPENSEARCH_PATH_CONF is also set as an environment variable and for a reference to ${OPENSEARCH_PATH_CONF} - // to work OPENSEARCH_JAVA_OPTS, we need to make sure that OPENSEARCH_PATH_CONF before OPENSEARCH_JAVA_OPTS. Instead, - // we replace the reference with the actual value in other environment variables - .map(p -> p.replace("${OPENSEARCH_PATH_CONF}", configFile.getParent().toString())) - .collect(Collectors.joining(" ")); + .stream() + .map(entry -> "-D" + entry.getKey() + "=" + entry.getValue()) + // OPENSEARCH_PATH_CONF is also set as an environment variable and for a reference to ${OPENSEARCH_PATH_CONF} + // to work OPENSEARCH_JAVA_OPTS, we need to make sure that OPENSEARCH_PATH_CONF before OPENSEARCH_JAVA_OPTS. Instead, + // we replace the reference with the actual value in other environment variables + .map(p -> p.replace("${OPENSEARCH_PATH_CONF}", configFile.getParent().toString())) + .collect(Collectors.joining(" ")); } String jvmArgsString = ""; if (jvmArgs.isEmpty() == false) { @@ -776,7 +776,7 @@ private Map getOpenSearchEnvironment() { defaultEnv.put( "OPENSEARCH_JAVA_OPTS", "-Xms" + heapSize + " -Xmx" + heapSize + " -ea -esa " + systemPropertiesString + " " + jvmArgsString + " " + - // Support passing in additional JVM arguments + // Support passing in additional JVM arguments System.getProperty("tests.jvm.argline", "") ); defaultEnv.put("OPENSEARCH_TMPDIR", tmpDir.toString()); @@ -1216,18 +1216,14 @@ private void createConfiguration() { ); final List configFiles; - try (Stream stream = Files.walk(getDistroDir().resolve("config"))) { + try (Stream stream = Files.list(getDistroDir().resolve("config"))) { configFiles = stream.collect(Collectors.toList()); } logToProcessStdout("Copying additional config files from distro " + configFiles); for (Path file : configFiles) { - Path relativePath = getDistroDir().resolve("config").relativize(file); - Path dest = configFile.getParent().resolve(relativePath); - if (Files.isDirectory(file)) { - Files.createDirectories(dest); - } else { - Files.createDirectories(dest.getParent()); - Files.copy(file, dest, StandardCopyOption.REPLACE_EXISTING); + Path dest = configFile.getParent().resolve(file.getFileName()); + if (Files.exists(dest) == false) { + Files.copy(file, dest); } } } catch (IOException e) { @@ -1301,13 +1297,13 @@ private Path getExtractedDistributionDir() { private List>> getInstalledFileSet(Action filter) { return Stream.concat(plugins.stream(), modules.stream()).map(p -> p.map(f -> { - if (f.exists()) { - final FileTree tree = archiveOperations.zipTree(f).matching(filter); - return tree.getFiles(); - } else { - return new HashSet(); - } - })) + if (f.exists()) { + final FileTree tree = archiveOperations.zipTree(f).matching(filter); + return tree.getFiles(); + } else { + return new HashSet(); + } + })) .map(p -> p.map(f -> f.stream().sorted(Comparator.comparing(File::getName)).collect(Collectors.toList()))) .collect(Collectors.toList()); } @@ -1396,8 +1392,8 @@ public boolean isProcessAlive() { void waitForAllConditions() { waitForConditions(waitConditions, System.currentTimeMillis(), NODE_UP_TIMEOUT_UNIT.toMillis(NODE_UP_TIMEOUT) + - // Installing plugins at config time and loading them when nods start requires additional time we need to - // account for + // Installing plugins at config time and loading them when nods start requires additional time we need to + // account for ADDITIONAL_CONFIG_TIMEOUT_UNIT.toMillis( (long) ADDITIONAL_CONFIG_TIMEOUT * (plugins.size() + keystoreFiles.size() + keystoreSettings.size() + credentials.size()) ), TimeUnit.MILLISECONDS, this);