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

CreateIfNotExist should not be the default

Open greg0ire opened this issue 4 months ago • 0 comments

  • Algolia Client Version: v3.31.0
  • Language Version: 1.21

Description

Right now index.PartialUpdateObjects() creates an object if it does not exist. That object is very likely to be invalid from the point of view of clients, since it does not have all fields. I believe that a more sensible default when no option is supplied should be opt.CreateIfNotExists(false).

Note that this behavior is inconsistent with other SDKs such as the PHP sdk: https://github.com/algolia/algoliasearch-client-php/blob/0bc527d95150319d6e8fca6dae398e4ad376d4b6/src/SearchIndex.php#L207

Steps To Reproduce

Call index.PartialUpdateObjects() with an object that does not already exist in the index.

greg0ire avatar Feb 09 '24 08:02 greg0ire