In phone right now so might me wrong idea, cannot ...
# community-help
t
In phone right now so might me wrong idea, cannot check so easy
f
Thank you for the idea, but I issue doesn't seem to be related with it. My problem is that
!
on the beginning of fliter_by is not working as I expected. I thought
"filter_by" : "!$blocks(blocker_user_id := 1)"
returns the posts by all the users except for those blocked by user_id 1, but is not working.
f
Hey @fudon the correct query would be:
"filter_by" : "$blocks(blocker_user_id :!= 1)"
f
@Fanis Tharropoulos Thank you, I have tried it but by this posts by users not included in the blocks collection will not be returned. IDs of users who aren't blocked by anyone are not in the collection.
t
Try to read about left join in docs and see if it helps. ”Left Join By default, Typesense performs inner join. To perform left join, { "filter_by": "id:* || $join_collection_name( <join_condition> )" } can be specified. id:* matches all documents of the collection being searched. So the result will include the referenced documents if a reference exists otherwise the document will be returned as is. # Filtering on null values in left joins You can also filter for documents where the joined collection does not have matching records (equivalent to filtering on null values in SQL). This is done by using the ! (not operator) at the beginning of the filter_by clause: { "searches": [ { "collection": "items", "q": "*", "filter_by": "!$deny_list(user_id:=u11)", "exclude_fields": "$deny_list(*)" } ] } This query returns all items that are NOT in the deny_list for user u11. Note: The exclude_fields parameter is important to prevent the deny list data from appearing in the search API response”
But maybe you already tried
Seems like the ! you tried hints you did