Filtering documents containing "Durian (\w+)" in description using filter_type `regexp`.Filtering documents containing "Durian (\w+)" in description using filter_type `regexp`.

Filtering documents containing "Durian (\w+)" in description using filter_type regexp.

Regex

This filter returns a document only if it matches regexp (i.e. regular expression). Note that substrings are covered in this category. For instance, if a product name is composed of a name and a number (e.g. ABC-123), one might remember the name but not the number. This filter can easily return all products including the ABC string.

Relevance AI has the same regular expression schema as Apache Lucene's ElasticSearch to parse queries.

Note that this filter is case-sensitive.

from relevanceai import Client 
client = Client()

# searching for "Durian" and more words following and before
filters =  [{
  'field' : 'description', # field to look at
    'filter_type' : 'regexp', 
    "condition":"==", 
    "condition_value":".*Durian (\w+)"
}] 
filtered_data = client.datasets.documents.get_where(dataset_id, filters)

Did this page help you?