Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use .multi as .load for long queries #5

Open
sobrinho opened this issue Jan 31, 2024 · 0 comments
Open

Allow to use .multi as .load for long queries #5

sobrinho opened this issue Jan 31, 2024 · 0 comments

Comments

@sobrinho
Copy link

sobrinho commented Jan 31, 2024

Hi,

We have a big query that raises that error:

Typesense::Error::RequestMalformed (Query string exceeds max allowed length of 4000. Use the /multi_search end-point for larger payloads.)

To workaround, we changed this:

MyIndex.search(query: query, query_by: query_by).facets(facets).sort(sort).filter(filter).page(page).per(per).load

To

Typesensual::Search.multi(MyIndex.search(query: query, query_by: query_by).facets(facets).sort(sort).filter(filter).page(page).per(per))[0]

Which is pretty much the same but using the multi endpoint.

We could have a helper method on the Search object to use this:

MyIndex.search(query: query, query_by: query_by).facets(facets).sort(sort).filter(filter).page(page).per(per).multi

Instead of

MyIndex.search(query: query, query_by: query_by).facets(facets).sort(sort).filter(filter).page(page).per(per).load

I would even say that we could rescue from that error automatically or even always use the multi endpoint since it is more robust.

What are your thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant