Cooper Leong
03/04/2025, 3:38 PMtype: [user]
, but they can search all other types (done so using the additionalSearchParameters { filterBy }
. Is there a better way to do this? I am using NodeJS backend and the instantsearch adapter in the frontend.Fanis Tharropoulos
03/04/2025, 4:32 PMCooper Leong
03/04/2025, 4:41 PM*
or an empty space, the filter_by
is no longer respected and all documents will be returned.Cooper Leong
03/04/2025, 9:58 PMq = "*"
the filter_by
is not properly filtering by type
how I have it defined, are you able to replicate this?Fanis Tharropoulos
03/05/2025, 7:33 AMCooper Leong
03/05/2025, 3:15 PMFanis Tharropoulos
03/05/2025, 4:11 PMCooper Leong
03/05/2025, 5:14 PMawait SearchClient.collections(collection_id).documents().search({
// NOTE: The colleciton usually includes entityD as well, but we don't want to search for it.
// So we are omitting it from the filter_by types, the query_by fields, and the include_fields.
// If I search for entityD.name directly (instead of q = "*"), it will return an empty array and
// no hits will be found (as expected), but if I search for q = "*", it will return all the hits
// including any hits for entityD. This is not the expected behavior.
q: "*",
filter_by: "accessibleTo: [<some_ids>], type: [entityA, entityB, entityC]",
query_by: "entityA.name, entityB.name, entityC.name",
include_fields: "id, type, entityA.name, entityB.name, entityC.name",
})
Cooper Leong
03/05/2025, 8:37 PMfilter_by
field was not using the right multiple conditions operator 🤦 , was using filter_by: "accessibleTo: [], type: []
rather than filter_by: "accessibleTo: [] && type: []
Looks like it is working as expected! ty!