Skip to content

Commit 221811a

Browse files
committed
Remove support for unknown attributes.
1 parent bd084c0 commit 221811a

File tree

2 files changed

+4
-34
lines changed

2 files changed

+4
-34
lines changed

redisvl/schema/fields.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,15 @@ def _normalize_field_modifiers(
107107
108108
RediSearch has a parser limitation (redis/redis#5177) where INDEXEMPTY and
109109
INDEXMISSING must appear BEFORE SORTABLE in field definitions. This function
110-
reorders field.args_suffix to match the canonical order while preserving
111-
unknown modifiers at the start.
110+
reorders field.args_suffix to match the canonical order.
112111
113112
Args:
114113
field: Redis field object whose args_suffix will be normalized
115114
canonical_order: List of modifiers in desired canonical order
116115
want_unf: Whether UNF should be added after SORTABLE (default: False)
117116
118117
Time Complexity: O(n + m) where n = len(field.args_suffix), m = len(canonical_order)
119-
Space Complexity: O(n + m)
118+
Space Complexity: O(n)
120119
121120
Example:
122121
>>> field = RedisTextField("title")
@@ -126,12 +125,9 @@ def _normalize_field_modifiers(
126125
['INDEXMISSING', 'SORTABLE']
127126
"""
128127
suffix_set = set(field.args_suffix)
129-
known_set = set(canonical_order)
130128

131-
# Preserve unknown modifiers in original order
132-
new_suffix = [t for t in field.args_suffix if t not in known_set]
133-
134-
# Add known modifiers in canonical order
129+
# Build new suffix with only known modifiers in canonical order
130+
new_suffix = []
135131
for modifier in canonical_order:
136132
if modifier in suffix_set:
137133
new_suffix.append(modifier)

tests/unit/test_field_modifier_ordering.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,7 @@ def test_basic_reordering(self):
252252

253253
assert field.args_suffix == ["INDEXMISSING", "SORTABLE"]
254254

255-
def test_preserves_unknown_modifiers(self):
256-
"""Test that unknown modifiers are preserved at the start."""
257-
field = RedisTextField("test")
258-
field.args_suffix = ["CUSTOM", "SORTABLE", "INDEXMISSING"]
259-
canonical_order = ["INDEXMISSING", "SORTABLE"]
260-
261-
_normalize_field_modifiers(field, canonical_order)
262255

263-
assert field.args_suffix == ["CUSTOM", "INDEXMISSING", "SORTABLE"]
264256

265257
def test_unf_added_with_sortable(self):
266258
"""Test that UNF is added when want_unf=True and SORTABLE is present."""
@@ -318,25 +310,7 @@ def test_empty_suffix(self):
318310

319311
assert field.args_suffix == []
320312

321-
def test_only_unknown_modifiers(self):
322-
"""Test with only unknown modifiers."""
323-
field = RedisTextField("test")
324-
field.args_suffix = ["CUSTOM1", "CUSTOM2"]
325-
canonical_order = ["INDEXMISSING", "SORTABLE"]
326-
327-
_normalize_field_modifiers(field, canonical_order)
328-
329-
assert field.args_suffix == ["CUSTOM1", "CUSTOM2"]
330-
331-
def test_multiple_unknown_modifiers_preserved_order(self):
332-
"""Test that multiple unknown modifiers preserve their original order."""
333-
field = RedisTextField("test")
334-
field.args_suffix = ["CUSTOM1", "SORTABLE", "CUSTOM2", "INDEXMISSING"]
335-
canonical_order = ["INDEXMISSING", "SORTABLE"]
336-
337-
_normalize_field_modifiers(field, canonical_order)
338313

339-
assert field.args_suffix == ["CUSTOM1", "CUSTOM2", "INDEXMISSING", "SORTABLE"]
340314

341315

342316
class TestMLPCommandsScenario:

0 commit comments

Comments
 (0)