Im trying to work out Dynamic filtering. If I add...
# community-help
t
Im trying to work out Dynamic filtering. If I add a filter with { "rule": { "query": "{attr_brand}", "match": "contains" }, "filter_by": "attr_brand:={attr_brand}", "remove_matched_tokens": true } It does nothing. In contrast without dynamic.. eg this "works" { "rule": { "query": "something", "match": "contains" }, "filter_by": "attr_brand:=something", "remove_matched_tokens": true } What could I be doing wrong? if it matters attr_brand is a dynamic property ie in the schema I have attr_*. This is the fields properties: {"facet":true,"index":true,"infix":false,"locale":"","name":"attr_brand","optional":true,"sort":false,"stem":false,"stem_dictionary":"","store":true,"type":"string"}
f
Hey Tim, Could you provide a small, reproducible example like this one, so we can debug?
t
Hey, thanks for replying. Here is my demo: https://gist.github.com/tmesolutions/931ae0ce55b802c0cac77ea5e9c4f49b Please let me know what I am doing wrong. I am doing the same search 2 times. What I would expect is the 2nd time (after creating the override) it should trigger the filter, and therefore not return results in the 2nd search for brand acmeco
ah my example actually works lol.. but I have worked out what the issue is. If the field is called attr_brand it does not work. if its called attrbrand without _ then it works 😕
Anyone able to tell me if thats by design in some way or if I should report it as a bug ? (having an _ in a attribute name means you cant make an override
This is a bug. I found a related bug back to version 26. They never gave an example script so I think it got lost. I have added exampled showing how its broken : https://github.com/typesense/typesense/issues/1988
f
Hey Tim, thank you for that. I'll be taking a look and get back to you.