#community-help

Canceling Search Requests in Typesense with Swift on iOS

TLDR Davide requested information on canceling search requests in Typesense with Swift. Sabesh confirmed it's currently unsupported but welcomed pull requests or raised issues on their GitHub repo.

Powered by Struct AI
May 26, 2023 (6 months ago)
Davide
Photo of md5-572829f7bdca950b38b6b9a3eedde7e5
Davide
07:43 AM
Hello everyone :man-raising-hand::skin-tone-3: Im a new user of Typesense (Swift on iOS) and I have a question:
is possible to cancel a search request? Or cancel any active search calls? The scenario is this:
I have an input field where user starts to input a key to search, with a debounce delay of 500ms, but the problem is that I wish to cancel any active search call and get data only from the very last one.
I saw the library for iOS but I do not see any function like "cancel" (or "remove", "delete", "reset") that stops the current request.
Is this going to be implemented in the future or what can you suggest to do to achieve my goal? Thanks 1k
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:37 PM
CC: Sabesh ^
Sabesh
Photo of md5-572192ad7f218ec2448dc33cb6f3e999
Sabesh
06:14 PM
Hey there Davide ! I am a little confused. There is no method to "cancel" or "stop" the request as of now. You can implement debouncing at a Text field level and only perform a search call after 500ms. Can you be a bit more elaborate as to what is the problem here? Thank you!
Davide
Photo of md5-572829f7bdca950b38b6b9a3eedde7e5
Davide
11:57 PM
We already did implement a 500ms debounce, but we need to be able to cancel the request because if we have some SSL connection error and we get the data after sometime that is causing some problem with the UI and the framework we are using (Eureka in this case) to display the data.
May 27, 2023 (6 months ago)
Sabesh
Photo of md5-572192ad7f218ec2448dc33cb6f3e999
Sabesh
06:36 AM
Oh alright. This functionality is not supported at the moment, but we'd really appreciate pull requests or issues raised on the github repo! 🙂
Davide
Photo of md5-572829f7bdca950b38b6b9a3eedde7e5
Davide
10:14 AM
Ok, I will make my fork, then I will see if that can be implemented; it would be nice to have a queue of operations, in case something happen or is needed, to stop everything immediately