Skip to content

Commit

Permalink
Nomenclature changes from Whitelist to Allowlist (#534)
Browse files Browse the repository at this point in the history
Signed-off-by: Naveen Tatikonda <navtat@amazon.com>

Signed-off-by: Naveen Tatikonda <navtat@amazon.com>
(cherry picked from commit c7379f8)
  • Loading branch information
naveentatikonda authored and github-actions[bot] committed Sep 6, 2022
1 parent 379bf9c commit 7ac096b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import java.util.List;
import java.util.Map;

public class KNNWhitelistExtension implements PainlessExtension {
public class KNNAllowlistExtension implements PainlessExtension {

private static final Whitelist ALLOW_LIST = WhitelistLoader.loadFromResourceFiles(KNNWhitelistExtension.class, "knn_whitelist.txt");
private static final Whitelist ALLOW_LIST = WhitelistLoader.loadFromResourceFiles(KNNAllowlistExtension.class, "knn_allowlist.txt");

@Override
public Map<ScriptContext<?>, List<Whitelist>> getContextWhitelists() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static float[] toFloat(List<Number> inputVector) {
}

/**
* Whitelisted l2Squared method for users to calculate L2 squared distance between query vector
* Allowlisted l2Squared method for users to calculate L2 squared distance between query vector
* and document vectors
* Example
* "script": {
Expand Down Expand Up @@ -110,7 +110,7 @@ public static float cosinesimilOptimized(float[] queryVector, float[] inputVecto
}

/**
* Whitelisted cosineSimilarity method that can be used in a script to avoid repeated
* Allowlisted cosineSimilarity method that can be used in a script to avoid repeated
* calculation of normalization for the query vector.
* Example:
* "script": {
Expand Down Expand Up @@ -156,7 +156,7 @@ public static float cosinesimil(float[] queryVector, float[] inputVector) {
}

/**
* Whitelisted cosineSimilarity method for users to calculate cosine similarity between query vectors and
* Allowlisted cosineSimilarity method for users to calculate cosine similarity between query vectors and
* document vectors
* Example:
* "script": {
Expand Down Expand Up @@ -216,7 +216,7 @@ public static float l1Norm(float[] queryVector, float[] inputVector) {
}

/**
* Whitelisted l1distance method for users to calculate L1 distance between query vector
* Allowlisted l1distance method for users to calculate L1 distance between query vector
* and document vectors
* Example
* "script": {
Expand Down Expand Up @@ -254,7 +254,7 @@ public static float lInfNorm(float[] queryVector, float[] inputVector) {
}

/**
* Whitelisted lInfNorm method for users to calculate L-inf distance between query vector
* Allowlisted lInfNorm method for users to calculate L-inf distance between query vector
* and document vectors
* Example
* "script": {
Expand Down Expand Up @@ -291,7 +291,7 @@ public static float innerProduct(float[] queryVector, float[] inputVector) {
}

/**
* Whitelisted innerProd method for users to calculate inner product distance between query vector
* Allowlisted innerProd method for users to calculate inner product distance between query vector
* and document vectors
* Example
* "script": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0

org.opensearch.knn.plugin.script.KNNWhitelistExtension
org.opensearch.knn.plugin.script.KNNAllowlistExtension
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void testBitHammingDistance_Long() {
assertEquals(0.0, KNNScoringUtil.calculateHammingBit(long3, long3), 0.1);
}

public void testL2SquaredWhitelistedScoringFunction() throws IOException {
public void testL2SquaredAllowlistedScoringFunction() throws IOException {
List<Number> queryVector = getTestQueryVector();
TestKNNScriptDocValues dataset = new TestKNNScriptDocValues();
dataset.createKNNVectorDocument(new float[] { 4.0f, 4.0f, 4.0f }, "test-index-field-name");
Expand Down

0 comments on commit 7ac096b

Please sign in to comment.