From 28de794d8eef47d3a0b0e21f0ec85b50417d014e Mon Sep 17 00:00:00 2001 From: Dmitry Kryukov Date: Wed, 23 Oct 2024 14:26:06 +0300 Subject: [PATCH] Changes based on comments in PR Signed-off-by: Dmitry Kryukov --- CHANGELOG.md | 2 +- .../search/suggest/phrase/NoisyChannelSpellChecker.java | 4 +--- .../java/org/opensearch/index/shard/IndexShardTestCase.java | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaa19dc397c5a..755c3437c7050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,7 +88,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - [Workload Management] Make query groups persistent across process restarts [#16370](https://github.com/opensearch-project/OpenSearch/pull/16370) - Fix inefficient Stream API call chains ending with count() ([#15386](https://github.com/opensearch-project/OpenSearch/pull/15386)) - Fix array hashCode calculation in ResyncReplicationRequest ([#16378](https://github.com/opensearch-project/OpenSearch/pull/16378)) -- Compare strings with equals() instead of == ([#16415](https://github.com/opensearch-project/OpenSearch/pull/16415)) +- Fix string equality comparisons ([#16415](https://github.com/opensearch-project/OpenSearch/pull/16415)) ### Security diff --git a/server/src/main/java/org/opensearch/search/suggest/phrase/NoisyChannelSpellChecker.java b/server/src/main/java/org/opensearch/search/suggest/phrase/NoisyChannelSpellChecker.java index 78bc6d22acb93..c347c97771c75 100644 --- a/server/src/main/java/org/opensearch/search/suggest/phrase/NoisyChannelSpellChecker.java +++ b/server/src/main/java/org/opensearch/search/suggest/phrase/NoisyChannelSpellChecker.java @@ -45,8 +45,6 @@ import java.util.ArrayList; import java.util.List; -import static org.apache.lucene.analysis.shingle.ShingleFilter.DEFAULT_TOKEN_TYPE; - /** * Spell checker based on a noisy channel * @@ -93,7 +91,7 @@ public void reset(TokenStream stream) { public void nextToken() throws IOException { anyTokens = true; BytesRef term = fillBytesRef(termsRef); - if (requireUnigram && DEFAULT_TOKEN_TYPE.equals(typeAttribute.type())) { + if (requireUnigram && ShingleFilter.DEFAULT_TOKEN_TYPE.equals(typeAttribute.type())) { return; } anyUnigram = true; diff --git a/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java b/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java index b71eadd21dc59..166c0cf706fce 100644 --- a/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java +++ b/test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java @@ -622,7 +622,7 @@ protected IndexShard newShard( Settings nodeSettings = Settings.builder().put("node.name", routing.currentNodeId()).build(); DiscoveryNodes discoveryNodes = IndexShardTestUtils.getFakeDiscoveryNodes(routing); // To simulate that the node is remote backed - if (Boolean.parseBoolean(indexMetadata.getSettings().get(IndexMetadata.SETTING_REMOTE_STORE_ENABLED))) { + if (indexMetadata.getSettings().getAsBoolean(IndexMetadata.SETTING_REMOTE_STORE_ENABLED, false)) { nodeSettings = Settings.builder() .put("node.name", routing.currentNodeId()) .put("node.attr.remote_store.translog.repository", "seg_repo")