Skip to content

Commit 52770dc

Browse files
committed
Update docstring per review
1 parent 24ebc8f commit 52770dc

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

redisvl/query/filter.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,24 +180,28 @@ def __ne__(self, other) -> "FilterExpression":
180180
return FilterExpression(str(self))
181181

182182
def __mod__(self, other: Union[List[str], str]) -> "FilterExpression":
183-
"""Create a Tag wildcard filter expression for prefix matching.
183+
"""Create a Tag wildcard filter expression for pattern matching.
184184
185185
This enables wildcard pattern matching on tag fields using the ``*``
186186
character. Unlike the equality operator, wildcards are not escaped,
187-
allowing prefix searches like ``"tech*"`` to match "technology",
188-
"technical", etc.
187+
allowing patterns with wildcards in any position, such as prefix
188+
(``"tech*"``), suffix (``"*tech"``), or middle (``"*tech*"``)
189+
matches.
189190
190191
Args:
191192
other (Union[List[str], str]): The tag pattern(s) to filter on.
192-
Use ``*`` for prefix matching (e.g., ``"tech*"``).
193+
Use ``*`` for wildcard matching (e.g., ``"tech*"``, ``"*tech"``,
194+
or ``"*tech*"``).
193195
194196
.. code-block:: python
195197
196198
from redisvl.query.filter import Tag
197199
198-
f = Tag("category") % "tech*" # Prefix match
199-
f = Tag("category") % "elec*|soft*" # Multiple prefix patterns
200-
f = Tag("category") % ["tech*", "sci*"] # List of patterns
200+
f = Tag("category") % "tech*" # Prefix match
201+
f = Tag("category") % "*tech" # Suffix match
202+
f = Tag("category") % "*tech*" # Contains match
203+
f = Tag("category") % "elec*|*soft" # Multiple wildcard patterns
204+
f = Tag("category") % ["tech*", "*science"] # List of patterns
201205
202206
"""
203207
self._set_tag_value(other, FilterOperator.LIKE)

0 commit comments

Comments
 (0)