typesense-swift
typesense-swift copied to clipboard
Allow search and multi-search to return raw data
Change Summary
Overriden 2 function:
-
Documents.search()
-
MultiSearch.perform()
Why make this change
Currently the above 2 function will take a Codable type T
and then try to decode it immediately after retrieving the data. This is not ideal because we lose the opportunities to implement a custom data parsing logic to it. E.g.
-
Documents.search()
: This function uses the default JSON decoder to decode the data. But sometimes we want to use other decoders, such as Firestore Decoder. -
MultiSearch.perform()
: This function only takes 1 type of Codable, which is not ideal. E.g. for a social media app, when searching a post, we want to have some search suggestions. They are different types of data and the function won't be able to decode the multi search result.
PR Checklist
- [x] I have read and signed the Contributor License Agreement.