Hi all! I’m encountering an issue with limits whe...
# community-help
n
Hi all! I’m encountering an issue with limits when using
multi_search
in my use case: • I have three collections: products, countries, and companies. • I perform a
multi_search
that queries each of these three collections. • I use the
per_page
parameter in the
common_search_params
. Here’s the problem: If I set
per_page
to 12, I expected to get a total of 12 results across all collections. However, I get 36 results instead (12 from each collection). Is there a workaround to enforce a total limit of 12 results across all collections combined? I’d be happy to clarify or discuss this further if needed. On a positive note, I’m excited because we’re planning to use Typesense in production on one of our sites starting January! Thanks in advance for your help! Best regards, Nicolás
j
The
per_page
parameter inside
multi_search
applies to each search, and not across searches. Currently, there's no way to limit the number of items across all searches
But this is an interesting requirement. Could you open a GitHub issue so we can track this as a feature request, and also track demand from other users?
n
Thank you! will do 👍
h
Is there a workaround to enforce a total limit of 12 results across all collections combined?
You can try setting
per_page
to 4.
n
Yes, the issue there is the ordering. Let’s say that 12 items are most relevant than all the others from the other collections. If I set per page to 4, i will get 4 most relevant and 8 that are less relevant than the following 8 from the first collection
h
How do you define relevance in your search? According to some aggregate score field or text match score?
n
text match score, but I also have a measure I could use.
h
Maybe you can look into the Union feature that's part of 28.0.rc30 build. https://github.com/typesense/typesense/pull/2051#issue-2636962334
n
Thanks! I will take a look 🙂
h
Hey @Nicolás Netz Did Union fulfill your requirement?