algolia/algoliasearch-client-ruby

feat(API): introducing the Recommendation client

Ant-hem opened this issue · 1 comments

Context

The personalization strategy endpoint will migrate from the Search API to the Recommendation API.

The consequences of the breaking changes are:

  • In search_client both methods get_personalization_strategy and set_personalization_strategy must be deprecated.
  • API Clients have to introduce a new recommendation client.

Recommendation client implementation

Endpoint

https://recommendation.{region}.algolia.com where region can be us or eu.

Please note that as for the current analytics_client the region should be
settable when instantiating the client.

Route

The route will be /1/strategies/personalization and support the following HTTP methods GET, POST, OPTIONS.

  • get_personalization_strategy -> GET : /1/strategies/personalization
  • set_personalization_strategy -> POST : /1/strategies/personalization

recommendation_client interface

interface recommendation_client {

    function get_personalization_strategy(opts: request_options)
    return get_personalization_strategy_response

    function set_personalization_strategy(set_strategy_request: strategy, opts: request_options)
    return set_personalization_strategy_response
}

Objects

struct set_strategy_request {
    eventsScoring: events_scoring[]
    facetsScroing: facets_scoring[]
    personalizationImpact: int
}
struct events_scoring {
    eventName: string
    eventType: string
    score: int
}
struct facets_scoring {
    facetName: string
    score: int
}

Responses

struct get_personalization_strategy_response {
    eventsScoring: events_scoring[]
    facetsScroing: facets_scoring[]
    personalizationImpact: int
}
struct set_personalization_strategy_response {
    status: int
    message: string
}

For more details regarding the implementation please see the specfication PR.

As discussed with @nunomaduro, we won't implement this in the v1 of the client.