class RecombeeApiClient::AddSearchSynonym

Adds a new synonym for the [Search items](docs.recombee.com/api.html#search-items).

When the `term` is used in the search query, the `synonym` is also used for the full-text search. Unless `oneWay=true`, it works also in the opposite way (`synonym` -> `term`).

An example of a synonym can be `science fiction` for the term `sci-fi`.

Attributes

ensure_https[RW]
one_way[R]
synonym[R]
term[R]
timeout[RW]

Public Class Methods

new(term, synonym, optional = {}) click to toggle source
* *Required arguments*
  - +term+ -> A word to which the `synonym` is specified.
  - +synonym+ -> A word that should be considered equal to the `term` by the full-text search engine.

* *Optional arguments (given as hash optional)*
  - +oneWay+ -> If set to `true`, only `term` -> `synonym` is considered. If set to `false`, also `synonym` -> `term` works.

Default: `false`.

# File lib/recombee_api_client/api/add_search_synonym.rb, line 33
def initialize(term, synonym, optional = {})
  @term = term
  @synonym = synonym
  optional = normalize_optional(optional)
  @one_way = optional['oneWay']
  @optional = optional
  @timeout = 10000
  @ensure_https = false
  @optional.each do |par, _|
    fail UnknownOptionalParameter.new(par) unless ["oneWay"].include? par
  end
end

Public Instance Methods

body_parameters() click to toggle source

Values of body parameters as a Hash

# File lib/recombee_api_client/api/add_search_synonym.rb, line 52
def body_parameters
  p = Hash.new
  p['term'] = @term
  p['synonym'] = @synonym
  p['oneWay'] = @optional['oneWay'] if @optional.include? 'oneWay'
  p
end
method() click to toggle source

HTTP method

# File lib/recombee_api_client/api/add_search_synonym.rb, line 47
def method
  :post
end
path() click to toggle source

Relative path to the endpoint

# File lib/recombee_api_client/api/add_search_synonym.rb, line 68
def path
  "/{databaseId}/synonyms/items/"
end
query_parameters() click to toggle source

Values of query parameters as a Hash. name of parameter => value of the parameter

# File lib/recombee_api_client/api/add_search_synonym.rb, line 62
def query_parameters
  params = {}
  params
end