#community-help

Typesense Querying for Multiple Song Artists

TLDR vikram wanted to query songs by multiple artists, but was having trouble. Kishore Nallan explained Typesense doesn't support OR queries, and suggested making two independent queries and merging the results.

Powered by Struct AI
10
11mo
Solved
Join the chat
Oct 31, 2022 (11 months ago)
vikram
Photo of md5-f930fdb99fd46477205fa1201164ea50
vikram
06:02 AM
Hi All, how to search song by artist and it will show song from that artist.so that it will take two query song name and artist name and it will search that
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:06 AM
You can search by song name (via query_by) and filter on artist name (via filter_by) . You can also just search on multiple fields by adding multiple names like this: query_by=name,author
vikram
Photo of md5-f930fdb99fd46477205fa1201164ea50
vikram
06:08 AM
i am searching for multi query search like arijit and jubin. it will show song from both.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
06:14 AM
I don't quite follow you. Please create a small sample dataset and exact query you are making and describe what you expect to see vs what you are getting.
vikram
Photo of md5-f930fdb99fd46477205fa1201164ea50
vikram
07:02 AM
In below screenshot i am searching for arijit and lata mangeshkar.but i am not getting any output related to that.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:04 AM
What record are you looking for the search to return? Can you post a screenshot of that?
vikram
Photo of md5-f930fdb99fd46477205fa1201164ea50
vikram
07:05 AM
it should return arijit or lata mangeshkar or both.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:18 AM
Ah, got it. We don't have a way to configure Typesense to make OR of the words in the query. Typesense will return results that match all tokens. If no such results are found, then only it will attempt to drop the tokens.
vikram
Photo of md5-f930fdb99fd46477205fa1201164ea50
vikram
07:19 AM
any idea how to implement that?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
07:19 AM
You can make two independent queries and then merge results client side.