class RecombeeApiClient::SearchItemSegments
Full-text personalized search that returns Segments from a Segmentation. The results are based on the provided ‘searchQuery` and also on the user’s past interactions (purchases, ratings, etc.).
Based on the used Segmentation, this endpoint can be used for example for:
- Searching within categories or brands - Searching within genres or artists
For example if the user is searching for “iPhone” this endpoint can return “cell phones” category.
You need to set the used Segmentation the Admin UI in the Scenario settings prior to using this endpoint.
The returned segments are sorted by relevance (first segment being the most relevant).
It is also possible to use POST HTTP method (for example in case of very long ReQL filter) - query parameters then become body parameters.
Attributes
Public Class Methods
Source
# File lib/recombee_api_client/api/search_item_segments.rb, line 62 def initialize(user_id, search_query, count, optional = {}) @user_id = user_id @search_query = search_query @count = count optional = normalize_optional(optional) @scenario = optional['scenario'] @cascade_create = optional['cascadeCreate'] @filter = optional['filter'] @booster = optional['booster'] @logic = optional['logic'] @expert_settings = optional['expertSettings'] @return_ab_group = optional['returnAbGroup'] @optional = optional @timeout = 3000 @ensure_https = false @optional.each do |par, _| fail UnknownOptionalParameter.new(par) unless ["scenario","cascadeCreate","filter","booster","logic","expertSettings","returnAbGroup"].include? par end end
* *Required arguments* - +user_id+ -> ID of the user for whom personalized search will be performed. - +search_query+ -> Search query provided by the user. It is used for the full-text search. - +count+ -> Number of segments to be returned (N for the top-N results). * *Optional arguments (given as hash optional)* - +scenario+ -> Scenario defines a particular application of recommendations. It can be, for example, "homepage", "cart", or "emailing".
You can set various settings to the [scenario](docs.recombee.com/scenarios.html) in the [Admin UI](admin.recombee.com). You can also see the performance of each scenario in the Admin UI separately, so you can check how well each application performs.
The AI that optimizes models to get the best results may optimize different scenarios separately or even use different models in each of the scenarios.
- +cascadeCreate+ -> If the user does not exist in the database, returns a list of non-personalized recommendations and creates the user in the database. This allows, for example, rotations in the following recommendations for that user, as the user will be already known to the system. - +filter+ -> Boolean-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to filter recommended segments based on the `segmentationId`. - +booster+ -> Number-returning [ReQL](https://docs.recombee.com/reql.html) expression which allows you to boost recommendation rate of some segments based on the `segmentationId`. - +logic+ -> Logic specifies the particular behavior of the recommendation models. You can pick tailored logic for your domain and use case.
See [this section](docs.recombee.com/recommendation_logics.html) for a list of available logics and other details.
The difference between ‘logic` and `scenario` is that `logic` specifies mainly behavior, while `scenario` specifies the place where recommendations are shown to the users.
Logic can also be set to a [scenario](docs.recombee.com/scenarios.html) in the [Admin UI](admin.recombee.com).
- +expertSettings+ -> Dictionary of custom options. - +returnAbGroup+ -> If there is a custom AB-testing running, return the name of the group to which the request belongs.
Public Instance Methods
Source
# File lib/recombee_api_client/api/search_item_segments.rb, line 88 def body_parameters p = Hash.new p['searchQuery'] = @search_query p['count'] = @count p['scenario'] = @optional['scenario'] if @optional.include? 'scenario' p['cascadeCreate'] = @optional['cascadeCreate'] if @optional.include? 'cascadeCreate' p['filter'] = @optional['filter'] if @optional.include? 'filter' p['booster'] = @optional['booster'] if @optional.include? 'booster' p['logic'] = @optional['logic'] if @optional.include? 'logic' p['expertSettings'] = @optional['expertSettings'] if @optional.include? 'expertSettings' p['returnAbGroup'] = @optional['returnAbGroup'] if @optional.include? 'returnAbGroup' p end
Values of body parameters as a Hash
Source
# File lib/recombee_api_client/api/search_item_segments.rb, line 83 def method :post end
HTTP method
Source
# File lib/recombee_api_client/api/search_item_segments.rb, line 110 def path "/{databaseId}/search/users/#{@user_id}/item-segments/" end
Relative path to the endpoint
Source
# File lib/recombee_api_client/api/search_item_segments.rb, line 104 def query_parameters params = {} params end
Values of query parameters as a Hash. name of parameter => value of the parameter