forked from opensearch-project/k-NN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vikasht34 <viktari@amazon.com> Signed-off-by: VIKASH TIWARI <viktari@amazon.com>
- Loading branch information
Showing
56 changed files
with
2,777 additions
and
1,092 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
46 changes: 46 additions & 0 deletions
46
src/main/java/org/opensearch/knn/common/featureflags/KNNFeatureFlags.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,46 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
*/ | ||
|
||
package org.opensearch.knn.common.featureflags; | ||
|
||
import com.google.common.annotations.VisibleForTesting; | ||
import lombok.experimental.UtilityClass; | ||
import org.opensearch.common.settings.Setting; | ||
import org.opensearch.knn.index.KNNSettings; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import static org.opensearch.common.settings.Setting.Property.Dynamic; | ||
import static org.opensearch.common.settings.Setting.Property.NodeScope; | ||
|
||
/** | ||
* Class to manage KNN feature flags | ||
*/ | ||
@UtilityClass | ||
public class KNNFeatureFlags { | ||
|
||
// Feature flags | ||
private static final String KNN_LAUNCH_QUERY_REWRITE_ENABLED = "knn.feature.query.rewrite.enabled"; | ||
private static final boolean KNN_LAUNCH_QUERY_REWRITE_ENABLED_DEFAULT = true; | ||
|
||
@VisibleForTesting | ||
public static final Setting<Boolean> KNN_LAUNCH_QUERY_REWRITE_ENABLED_SETTING = Setting.boolSetting( | ||
KNN_LAUNCH_QUERY_REWRITE_ENABLED, | ||
KNN_LAUNCH_QUERY_REWRITE_ENABLED_DEFAULT, | ||
NodeScope, | ||
Dynamic | ||
); | ||
|
||
public static List<Setting<?>> getFeatureFlags() { | ||
return Stream.of(KNN_LAUNCH_QUERY_REWRITE_ENABLED_SETTING).collect(Collectors.toUnmodifiableList()); | ||
} | ||
|
||
public static boolean isKnnQueryRewriteEnabled() { | ||
return Boolean.parseBoolean(KNNSettings.state().getSettingValue(KNN_LAUNCH_QUERY_REWRITE_ENABLED).toString()); | ||
} | ||
} |
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
Oops, something went wrong.