Filtering documents containing "Durian BID" in description using filter_type `contains`.


This filter returns a document only if it contains a string value. 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.
Note that this filter is case-sensitive.

# remove `!` if running the line in a terminal
!pip install -U RelevanceAI[notebook]==2.0.0
from relevanceai import Client

You can sign up/login and find your credentials here:
Once you have signed up, click on the value under `Activation token` and paste it here
client = Client()
DATASET_ID = "ecommerce-sample-dataset"
ds = client.Dataset(DATASET_ID)
filter = [
        "field": "description",
        "filter_type": "contains",
        "condition": "==",
        "condition_value": "Durian BID"
filtered_data = ds.get_documents(filters=filter, n = 20)

Did this page help you?