Series.os_match

Series.os_match(text: str, *, match_phrase: bool = False, match_only_text_fields: bool = True, analyzer: str | None = None, fuzziness: int | str | None = None, **kwargs: Any) QueryFilter[source]

Filters data with an OpenSearch match or match_phrase query depending on the given parameters.

Read more about Full-Text Queries in OpenSearch

All additional keyword arguments are passed in the body of the match query.

Parameters

text: str

String of text to search for

match_phrase: bool, default False

If True will use match_phrase instead of match query which takes into account the order of the text parameter.

match_only_text_fields: bool, default True

When True this function will raise an error if any non-text fields are queried to prevent fields that aren’t analyzed from not working properly. Set to False to ignore this preventative check.

analyzer: str, optional

Specify which analyzer to use for the match query

fuzziness: int, str, optional

Specify the fuzziness option for the match query

Returns

QueryFilter

Boolean filter to be combined with other filters and then passed to DataFrame[…].

Examples

>>> from tests import OPENSEARCH_TEST_CLIENT
>>> df = oml.DataFrame(
...   OPENSEARCH_TEST_CLIENT, "ecommerce",
...   columns=["category", "taxful_total_price"]
... )
>>> df[
...     df.category.os_match("Men's")
...     & (df.taxful_total_price > 200.0)
... ].head(5)
                               category  taxful_total_price
13                     [Men's Clothing]              266.96
33                     [Men's Clothing]              221.98
54                     [Men's Clothing]              234.98
93   [Men's Shoes, Women's Accessories]              239.98
273                       [Men's Shoes]              214.98

[5 rows x 2 columns]