Skip to content

Commit 363ef39

Browse files
adds CASESENSITIVE to manually processed index attributes
1 parent 518219a commit 363ef39

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

redisvl/redis/connection.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,22 @@ def parse_vector_attrs(attrs):
9898
return vector_attrs
9999

100100
def parse_attrs(attrs):
101-
# 'SORTABLE', 'UNF', 'NOSTEM' don't have corresponding values.
101+
# 'SORTABLE', 'NOSTEM' don't have corresponding values.
102102
# Their presence indicates boolean True
103+
# TODO 'WITHSUFFIXTRIE' is another boolean attr, but is not returned by ft.info
103104
original = attrs.copy()
104105
parsed_attrs = {}
105106
if "NOSTEM" in attrs:
106107
parsed_attrs["no_stem"] = True
107108
attrs.remove("NOSTEM")
108-
for special_attr in ["SORTABLE", "UNF"]:
109-
if special_attr in attrs:
110-
parsed_attrs[special_attr.lower()] = True
111-
attrs.remove(special_attr)
109+
if "CASESENSITIVE" in attrs:
110+
parsed_attrs["case_sensitive"] = True
111+
attrs.remove("CASESENSITIVE")
112+
if "SORTABLE" in attrs:
113+
parsed_attrs["sortable"] = True
114+
attrs.remove("SORTABLE")
115+
if "UNF" in attrs:
116+
attrs.remove("UNF") # UNF present on sortable numeric fields only
112117

113118
try:
114119
parsed_attrs.update(

tests/integration/test_search_index.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"type": "text",
1515
"attrs": {"no_stem": True, "sortable": True},
1616
},
17+
{"name": "test_tag", "type": "tag", "attrs": {"case_sensitive": True}},
18+
{"name": "test_numeric", "type": "numeric"},
19+
{"name": "test_numeric_attrs", "type": "numeric", "attrs": {"sortable": True}},
1720
]
1821

1922

0 commit comments

Comments
 (0)