{"action":"created","issue":{"url":"https://api.github.com/repos/algolia/algoliasearch-helper-js/issues/362","repository_url":"https://api.github.com/repos/algolia/algoliasearch-helper-js","labels_url":"https://api.github.com/repos/algolia/algoliasearch-helper-js/issues/362/labels{/name}","comments_url":"https://api.github.com/repos/algolia/algoliasearch-helper-js/issues/362/comments","events_url":"https://api.github.com/repos/algolia/algoliasearch-helper-js/issues/362/events","html_url":"https://github.com/algolia/algoliasearch-helper-js/issues/362","id":173228248,"number":362,"title":"API: function based initial config on the Helper","user":{"login":"bobylito","id":393765,"avatar_url":"https://avatars.githubusercontent.com/u/393765?v=3","gravatar_id":"","url":"https://api.github.com/users/bobylito","html_url":"https://github.com/bobylito","followers_url":"https://api.github.com/users/bobylito/followers","following_url":"https://api.github.com/users/bobylito/following{/other_user}","gists_url":"https://api.github.com/users/bobylito/gists{/gist_id}","starred_url":"https://api.github.com/users/bobylito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobylito/subscriptions","organizations_url":"https://api.github.com/users/bobylito/orgs","repos_url":"https://api.github.com/users/bobylito/repos","events_url":"https://api.github.com/users/bobylito/events{/privacy}","received_events_url":"https://api.github.com/users/bobylito/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-25T15:03:45Z","updated_at":"2016-08-26T09:00:34Z","closed_at":null,"body":"One thing that we've noticed is that modifying a SearchParameter object is much simpler that working with the raw data structure. Also implementations based on the data structure is likely to break at some point if it ever evolves, whereas with the functions of the SearchParameters we can maintain the same API while modifying the underlying structure.\r\n\r\n## Proposal\r\n\r\n```js\r\nvar helper = algoliasearchHelper(client, index, function(params) {\r\n  return params.addDisjunctiveFacet('categories')\r\n\t       .addDisjunctiveFacetRefinement('categories', 'shirts');\r\n});\r\n```\r\n\r\nThis won't remove the possibility to pass an object, it's just a more friendly alternative to set the configuration and the default parameters."},"comment":{"url":"https://api.github.com/repos/algolia/algoliasearch-helper-js/issues/comments/242672703","html_url":"https://github.com/algolia/algoliasearch-helper-js/issues/362#issuecomment-242672703","issue_url":"https://api.github.com/repos/algolia/algoliasearch-helper-js/issues/362","id":242672703,"user":{"login":"bobylito","id":393765,"avatar_url":"https://avatars.githubusercontent.com/u/393765?v=3","gravatar_id":"","url":"https://api.github.com/users/bobylito","html_url":"https://github.com/bobylito","followers_url":"https://api.github.com/users/bobylito/followers","following_url":"https://api.github.com/users/bobylito/following{/other_user}","gists_url":"https://api.github.com/users/bobylito/gists{/gist_id}","starred_url":"https://api.github.com/users/bobylito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobylito/subscriptions","organizations_url":"https://api.github.com/users/bobylito/orgs","repos_url":"https://api.github.com/users/bobylito/repos","events_url":"https://api.github.com/users/bobylito/events{/privacy}","received_events_url":"https://api.github.com/users/bobylito/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T09:00:34Z","updated_at":"2016-08-26T09:00:34Z","body":"> I feel what we could ask ourselves here is: \"What does this API brings today that cannot be done easily with the current API?\" and I am not sure to find a lot of differences.\r\n\r\nYou are right, for today, the benefits are thin. User wise it make only a slight difference.\r\n\r\nHowever the programmatic API is more future proof (does not rely on structure that can change) and I would like to propose this alternative in order to deprecate the object one. Also proposing this would be also a win for instantsearch.js, for which this paradigm is closer.\r\n\r\nAlso providing a function means that it can be replay. Which could also be interesting for default parameters implementation."}}
{"actor":{"display_login":"bobylito"}}