hey guys, im getting this error: ```"Query string...
# community-help
a
hey guys, im getting this error:
Copy code
"Query string exceeds max allowed length of 4000. Use the /multi_search end-point for larger payloads."
How would i get around this? Im using flutter so i dont know if i need to change the search function. For reference, that function looks like:
Copy code
Future<Map<String, dynamic>> search(
      Map<String, dynamic> searchParameters) async {
    return await _apicall.get(
      '$_endPoint/search',
      queryParams: searchParameters,
      shouldCacheResult: true,
    );
  }
Will changing /search to /multiSearch work?
j
Correct, you would have to switch to using multi search
a
Im having a bit of trouble editing the package's file. I created
Copy code
Future<Map<String, dynamic>> multiSearch(
      Map<String, dynamic> searchParameters) async {
    return await _apicall.get(
      '$_endPoint/multi_search',
      queryParams: searchParameters,
      shouldCacheResult: true,
    );
  }
Inside of documents.dart, but when i try to call the method, i get
Copy code
Error: The method 'multiSearch' isn't defined for the class 'Documents'.
lib/…
- 'Documents' is from 'package:typesense/src...').
package:typesense/src/documents.dart:1
Try correcting the name to the name of an existing method, or defining a method named 'multiSearch'.
        await _typesenseClient.collection('users').documents.multiSearch({
                                                             ^^^^^^^^^^^
Any idea why this doesnt work?
j
Multi search is already implemented in the dart library, so you can use it directly like in the code sample here: https://typesense.org/docs/0.23.1/api/federated-multi-search.html
a
I think i got it working, is there a drawback to using multisearch instead of normal search? Ie why not use it by default?
j
We had single collection search first and we added multi search in a later version to search across collections efficiently. But you can still use multi search to search just one collection. There are no differences except that multi search uses post and single collection search uses GET
a
Awesome, thanks!
And slightly related, but i had to switch because i hit the string length limit for a query on single search. Is multi search unbounded?
j
Correct
👍 1