Hi, Can we use `filter_by` to filter array using n...
# community-help
g
Hi, Can we use
filter_by
to filter array using non-exact match ? it seems
genres:=[Rock]
will filter with exact match Thanks
h
genres:!=[Rock]
should work
g
My bad, I meant filtering using contain clause
It seems this not working
genres:[Rock]
k
Without = it should do contains
g
I didn't get it working without the =. I used instead of filter_by,
query_by
with
q
that seems to performs what I need
k
Can you post a small example data and query just so I see could be going wrong?
g
data:
Copy code
[
{paths:["beverage/beer","food/cake"]},
{paths:["beverage/beer/brown","food/cake"]},
]
query: filter_by
paths:[beverage]
k
That's because of the / character. String will be indexed as beveragebeer so word won't match with filter.
g
Ok I see. Could you please just clarify why it works using query_by and q?
k
Because query by supports prefix search
g
Ok :) now I got something working and clear
Thanks