Hello! I’m a bit stuck with my particular use case. Essentially users can have content that is private to them or shared with everyone. The index contains a user_id field and a shared field. I generate a secured API key which should have filters that enforce this rule for each user. The obvious solution is to do shared:true OR (shared:false AND user:user_id) however according to the docs (https://www.algolia.com/doc/api-reference/api-parameters/filters/) you can’t have disjunctions (OR) of conjunctions (AND), i.e. this solution doesn’t work.
Has anyone run into a similar use case and how did you deal with it? I’m considering of changing the index fields so instead of a shared field I have a can_access field which can either be a list of user ids, or all to signify that it’s shared with everyone. This way my filter could just be can_access:all OR can_access:user_id (which will match if the user_id is in the array of ids). Does this seem sane?
The other thing I could do just keep the shared content in Algolia and load the private content from my own DB when the app starts (since we know it won’t change without this user changing it). This seems fairly reasonable and the performance would be better since I could show their content immediately (no loading time).
Any and all opinions are welcome, thanks in advance