Hi everyone, we are using a filter by like below `...
# community-help
v
Hi everyone, we are using a filter by like below
Copy code
variantTitle : `queen`
we are noticing that this doesn't match documents which have variant title as
Queen/SomeWordHere
. Can anyone help me understand what that is? Is it because the
:
operator does token match, and
Queen/SomeWordHere
is not matching with the
queen
token? Is there a way to make it do substring match instead? Or is the only way creating a new collection with
/
as a token separator? TIA!
k
Does it work if you tried with
queensome
(i.e. longer prefix)
v
From the testing I have done, the entire
queen/somewordhere
matches, and
queensomewordhere
(without the /) also matches but anything smaller doesn't match.
k
We look at limited number of prefixes during filter by prefix search. In recent v28 builds, we support a
max_filter_by_candidates
option that can be used to increase the default value of
4
which might help here.
v
Okay, we're on typesense v27 the v28 solution can't work at the moment. Would setting
/
as token separator help then?
k
Does
queensome
work?
v
No. One of the actual values is Queen/Double. Only
queen/double
or
queendouble
works. No other value works.
k
You can check locally on a v28 RC build whether setting
max_filter_by_candidates: 100
works.
v
Hi @Kishore Nallan, I tried with rc8. It doesn't seem to help:
Copy code
curl --location '<http://localhost:8108/collections/product_variant/documents/search?q=*&filter_by=title%20%3A%20%60Queen%60&max_filter_by_candidates=100>' \
--header 'x-typesense-api-key: xyz'
results are empty. I'm using the image
typesense/typesense:28.0.rc8
k
You probably need to create an issue once again with a reproducible set so we can look. I've fixed 1/3 issues you have reported so far. 2nd one in-progress.
v
Thank you, will raise it in some time 👍
h
@Vamshi Aruru Have you tried sending
filter_by=title : Queen*
?
k
filter_by=title : Queen*
should work @Vamshi Aruru -- I somehow forgot that prefix filtering on the filter_by clause requires that trailing asterisk.
v
Apologies for the delay in response! Was away for Diwali 🙂 I can't use Queen* because while for this case it is a prefix search, for many cases it is a
CONTAINS
test (as in the word can be present anywhere in the field, not just at the start).
k
filter_by=title : Queen*
will match a record with title
The Queensland