Hi everyone, is there a filter_by value I can give...
# community-help
v
Hi everyone, is there a filter_by value I can give for a field that matches everything? The usecase is that we want to dynamically construct a typesense filter_by statement based on the values present in a document using templates. For example, let's say we have a templated filter_by like
filter_by="field_1:{{.field_1} && field_2:!={{.field_1}}"
Now at run time, I want to be able to populate this template based on the values from a particular document. Now I can do all that fairly easily, but the problem is what happens if the document doesn't contain say
field_1
. In that case I want to be able to provide a value that basically makes typesense ignore that specific filter of filter_by. Is there a way to that? Perhaps maybe a special symbol like
*
or something? I understand this is a very niche requirement, but I was wondering if there was a way to accomplish this. If I was able to parse the filter_by into a syntax tree like structure, I could traverse the tree and prune the branches with specific fields, but I am not sure how to do that either. Does typesense have a filter_by parser I can use? Thanks for the help!