Is the equal filter implicitely matching substrings?

In my collection I have a property defined as:
wvcc.Property(name="app_id", data_type=wvcc.DataType.TEXT)
which contains a string value of which the following is an example:
2023-10-29-freud-dai-propri-fantasmi-alle-verita-oggettive
if I perform a qery as follows:

response = collection.query.fetch_objects(
                filters=wvc.query.Filter.by_property("app_id").equal('freud-dai-propri-fantasmi-alle-verita-oggettive'),
                limit=1,
            )

(please not that it’s a substring) I get a response.object match.
I would have expected this behaviour to be exhibited by the like operator.
Thank you
PS Is this the best pattern to check if I do have a specific object in the collection similarly to a SQL LIKE condition on a text field ?

Hi!

The matching will always depend on how your field is tokenized:

by default the tokenization is word, meaning that you field will become a list of the tokens:

2023
10
29
freud
dai
propri
fantasmi
alle
verita
oggettive

I imagine you will want the field tokenization, so the entire content will become one token, and you can use it as a reference for filtering.

Let me know if this helps :slight_smile:

1 Like

You’re teaching me so much. I’m really grateful.
So if I change the tokenization to field I could also use the like when needed.
Thanks a lot.

1 Like

That’s right!

Just a side note: the tokenization configuration is not mutable:

So you will need to reindex your data :grimacing:

Glad you are learning here! All your questions and insights is really helpful as other will also learn with all those!

So thank you too!

1 Like