Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor formatting & linting changes
Signed-off-by: Aniket Paluskar <apaluska@redhat.com>
  • Loading branch information
aniketpalu committed Dec 11, 2025
commit 04e6fcc05356ba4bbd3a9a8a22b9c45938724453
10 changes: 5 additions & 5 deletions sdk/python/feast/api/registry/rest/rest_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,22 +561,22 @@ def filter_search_results_and_match_score(
matched_tag = None
best_fuzzy_score = 0.0
best_fuzzy_tag = None

for key, value in tags.items():
key_lower = key.lower()
value_str = str(value).lower()

# Exact match in key or value
if query_lower in key_lower or query_lower in value_str:
tag_match = True
# Store the matched tag as a dictionary
matched_tag = {key: value}
break

# Fuzzy match for tags (on combined "key:value" string)
tag_combined = f"{key_lower}={value_str}"
tag_fuzzy_score = fuzzy_match(query_lower, tag_combined)

if tag_fuzzy_score > best_fuzzy_score:
best_fuzzy_score = tag_fuzzy_score
best_fuzzy_tag = {key: value}
Expand All @@ -586,7 +586,7 @@ def filter_search_results_and_match_score(
result["matched_tag"] = matched_tag
filtered_results.append(result)
continue

# Fuzzy tag match
if best_fuzzy_score >= MATCH_SCORE_DEFAULT_THRESHOLD:
result["match_score"] = best_fuzzy_score * 100
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/tests/unit/api/test_search_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ def test_search_matched_tag_exact_match(self, search_test_app):

def test_search_matched_tag_fuzzy_match(self, search_test_app):
"""Test that matched_tag field is present when a tag matches via fuzzy matching"""
# Search for "te" which should fuzzy match tag key "team"
# Search for "te" which should fuzzy match tag key "team"
# "te" vs "team": overlap={'t','e'}/union={'t','e','a','m'} = 2/4 = 50% (below threshold)
# Try "tea" which should fuzzy match "team" better
# "tea" vs "team": overlap={'t','e','a'}/union={'t','e','a','m'} = 3/4 = 75% (above threshold)
Expand Down