File tree Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Expand file tree Collapse file tree 2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,25 @@ def parse_vector_attrs(attrs):
9898 return vector_attrs
9999
100100 def parse_attrs (attrs ):
101- return {attrs [i ].lower (): attrs [i + 1 ] for i in range (6 , len (attrs ), 2 )}
101+ # 'SORTABLE', 'UNF', 'NOSTEM' don't have corresponding values.
102+ # Their presence indicates boolean True
103+ original = attrs .copy ()
104+ parsed_attrs = {}
105+ if "NOSTEM" in attrs :
106+ parsed_attrs ["no_stem" ] = True
107+ 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 )
112+
113+ try :
114+ parsed_attrs .update (
115+ {attrs [i ].lower (): attrs [i + 1 ] for i in range (6 , len (attrs ), 2 )}
116+ )
117+ except IndexError as e :
118+ raise IndexError (f"Error parsing index attributes { original } , { str (e )} " )
119+ return parsed_attrs
102120
103121 schema_fields = []
104122
Original file line number Diff line number Diff line change 66from redisvl .redis .utils import convert_bytes
77from redisvl .schema import IndexSchema , StorageType
88
9- fields = [{"name" : "test" , "type" : "tag" }]
9+ fields = [
10+ {"name" : "test" , "type" : "tag" },
11+ {"name" : "test_text" , "type" : "text" },
12+ {
13+ "name" : "test_text_attrs" ,
14+ "type" : "text" ,
15+ "attrs" : {"no_stem" : True , "sortable" : True },
16+ },
17+ ]
1018
1119
1220@pytest .fixture
@@ -87,7 +95,7 @@ def test_search_index_from_existing_complex(client):
8795 "name" : "age" ,
8896 "type" : "numeric" ,
8997 "path" : "$.metadata.age" ,
90- "attrs" : {"sortable" : False },
98+ "attrs" : {"sortable" : True },
9199 },
92100 {
93101 "name" : "user_embedding" ,
You can’t perform that action at this time.
0 commit comments