algoliasearch-client-go icon indicating copy to clipboard operation
algoliasearch-client-go copied to clipboard

Avoid unmarshalling QueryRes.Hits into json default types

Open georgantasp opened this issue 1 year ago • 0 comments

  • Algolia Client Version: v3.30.1
  • Language Version: 1.20

Description

During the unmarshalling of the QueryRes object, the existing implementation will completely unmarshal each hit object into json default types. As a result, the method QueryRes.UnmarshalHits remarshals the default types just to unmarshal again into the users's desired type. For large result sets and/or large objects, this can be wasteful.

~PR incoming...~ PR

Steps To Reproduce

res, _index.Search(query, params...)
algoliaObjectResults := []AlgoliaObject{}
res.UnmarshalHits(&algoliaObjectResults)

georgantasp avatar Nov 02 '23 00:11 georgantasp