Algolia array search

m
I have tag paramaters for search interest. Client send to array [‘dogs’,‘azure’] like this.

var data = req.body.tags;
//tags = [‘cats’,‘azure’]
for(i=0;data.length;i++)
{
index.search({
query:data[i]
}),
function searchDone(err,content) {
console.log(content.hits)
}

return

[{name:“user1”,interest:[dogs,cat]}][{name:“user2”,interest:[Azure,Books]}]

I want to

[{name:“user1”,interest:[dogs,cat]}
{name:“user2”,interest:[Azure,Books]}]

I want to search same field in the same time and return the one array json

This code return 2 array json and When I entered cats and dogs same user return 2 time,
Is there options for this in Algolia Deshbord, If not there how can I fix code

Hi @cevizbilgi34, to better help you out, could you send us a working code example that we can try out? Using maybe a temporary index.

We need to be able to replicate your issue and understand what you would want in more details.

It’s already a detailed question but we need to be able to replicate your issue with code to understand how you are receiving a JSON made of two arrays instead of a single array.

No matter what, if you are receiving two arrays, merging them is only a matter of generic JavaScript coding.

Let me know how it goes,

Happy Coding!

1 Like

Users entering in searchbar can write like this = azure dogs

I’m convert to array format like this = [‘azure’,‘dogs’]

I want to search either dogs AND Azure,as well as dogs OR azure in the one search,

I would like to list users who have dogs and azure or who are just a dogs or azure

I can explain from sql = select *from Users where interest like ‘cats’ or ineterest like ‘azure’ I want to like this actually,
Thanks for help