[Feature]: Support "&" and "|" operator in boolean expression
#18,805 opened on Aug 24, 2022
Repository metrics
- Stars
- (44,298 stars)
- PR merge metrics
- (Avg merge 7d) (314 merged PRs in 30d)
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe.
Users may have a lot of bool attributes to do filtering.
He can create a bool field for each attribute:
bool_1, bool_2, bool_3, ....
He want to filter out the entities which bool_1=true, bool_2=ture, bool_3=true.
He can do search filtering by this expression:
search(expr="bool_1 && bool_2 && bool_3")
This approach is not efficient. It creates too many fields in a collection. And not easy to expand, when there is a new bool attribute, he need to create a new collection with the new field.
We can combine the bool attributes into an int64 value, with only one int64 field for the collection. Convert bool_1 as the first bit of the int64 value, bool_2 as the second bit, bool_3 as the third bit, etc. Then each int64 field can support up to 64 bool attributes.
And do search filtering in this way(assume the int64 field name is "flag"): search(expr="flag & 8 == 0")
Describe the solution you'd like.
No response
Describe an alternate solution.
No response
Anything else? (Additional Context)
No response