Skip to content

Commit aa918e3

Browse files
lingyinwcopybara-github
authored andcommitted
feat: Support NOT_EQUAL for MatchingEngineIndexEndpoint numeric_restricts.
PiperOrigin-RevId: 623343218
1 parent fa35b91 commit aa918e3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

google/cloud/aiplatform/matching_engine/matching_engine_index_endpoint.py

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class NumericNamespace:
9292
"EQUAL" for datapoints' values = query's value;
9393
"GREATER_EQUAL" for datapoints' values >= query's value;
9494
"GREATER" for datapoints' values > query's value;
95+
"NOT_EQUAL" for datapoints' values != query's value
9596
"""
9697

9798
name: str

tests/unit/aiplatform/test_matching_engine_index_endpoint.py

+5
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,13 @@
240240
NumericNamespace(name="cost", value_double=0.3, op="EQUAL"),
241241
NumericNamespace(name="size", value_int=0, op="GREATER"),
242242
NumericNamespace(name="seconds", value_float=-20.5, op="LESS_EQUAL"),
243+
NumericNamespace(name="duration", value_int=10, op="NOT_EQUAL"),
243244
]
244245
_TEST_NUMERIC_NAMESPACE = [
245246
match_service_pb2.NumericNamespace(name="cost", value_double=0.3, op=3),
246247
match_service_pb2.NumericNamespace(name="size", value_int=0, op=5),
247248
match_service_pb2.NumericNamespace(name="seconds", value_float=-20.5, op=2),
249+
match_service_pb2.NumericNamespace(name="duration", value_int=10, op="NOT_EQUAL"),
248250
]
249251
_TEST_IDS = ["123", "456", "789"]
250252
_TEST_PER_CROWDING_ATTRIBUTE_NUM_NEIGHBOURS = 3
@@ -1421,6 +1423,9 @@ def test_index_public_endpoint_match_queries_with_numeric_filtering(
14211423
gca_index_v1beta1.IndexDatapoint.NumericRestriction(
14221424
namespace="seconds", value_float=-20.5, op="LESS_EQUAL"
14231425
),
1426+
gca_index_v1beta1.IndexDatapoint.NumericRestriction(
1427+
namespace="duration", value_int=10, op="NOT_EQUAL"
1428+
),
14241429
],
14251430
),
14261431
per_crowding_attribute_neighbor_count=_TEST_PER_CROWDING_ATTRIBUTE_NUM_NEIGHBOURS,

0 commit comments

Comments
 (0)