Trouble Structuring Query with Multiple Params of User Input

Hi,
I am trying to be able search with two query parameters purely from user input.
In my ios app a user enters an industry in one search field and a username in another.

[“industry”: industrySearchText, “query”: usernameSearchText]

In an sql world, “Search * WHERE industry = industrySearchText AND query = useranameSearchText”

When i run my google cloud function I get no results despite having objects saved in my index that meet the criteria.
I have tried to find docs/forums on how to structure the query to correctly filter on the userinput but I cant find any.

Any help on how to do this would be greatly appreciated!

In my google cloud function to search algolia this is what I have.
I have already set the facets as industry and username

const query = event.data.val().query;
const industry = event.data.val().industry

const industrySearch = {
query: event.data.val(),
filters: industry:${industry} AND username:${query}
}

return index.search(industrySearch)

Thanks,
Tim

Hi,
Just figured it out. When doing the string interpolator I wasnt putting double quotes around the interpolated values. industry:${industry} AND username:${query} should have been industry:"${industry}" AND username:"${query}"

1 Like