logo

English

Submit Feedback

There are three types of feedback:
  1. Search feedback: this feedback is submitted when a user searches then hits a search result.
  2. Autocomplete feedback: this feedback is submitted when a user hits an autocomplete suggestion.
  3. Recommendation feedback: this feedback is submitted when a user hits a recommended article.

Submit Search Feedback

$lableb->submitSearchFeedback( $collection, $options, [$handler] )
  1. $collection: collection name that search has been made in.
  2. $options: an associative describing the hit document.
  3. $handler: an optional parameters which defaults to default and it is handler name used in search.
Search Feedback Options ($options):
OptionDescriptionRequiredExample
querywhat was the query user searched foryes'how to make pizza'
item_idthe ID of the hit resultyes1
item_order     the order of the hit in the results starting from 1 not from 0yes1
urlurl of the source documentyes'https://funfunfood.com/2018/12/06/pizza'
user_ida unique user idno1254
user_ipuser IP addressno'55.22.11.6'
countryuser country codeno'CA'
Example:
try
{
  $lableb->submitSearchFeedback( 'posts', [
    'query' => 'How to make pizza',
    'item_id' => 1,
    'item_order' => 1,
    'url' => 'https://funfunfood.com/2018/12/06/pizza'
  ] );
}
catch( \Lableb\Exceptions\LablebException $e )
{
  echo $e->getMessage();
}

Example response:
[
  'submitted' => true
]

Submit Autocomplete Feedback

$lableb->submitAutocompleteFeedback( $collection, $options, [$handler] )
Exactly same as Search feedback submission but item_id and url are not required for navigational suggestions.

Submit Recommendation Feedback

$lableb->submitRecommendationFeedback( $collection, $source, $target, [$handler] )
  1. $collection: collection name that search for recommendations has been made in.
  2. $source: the source document.
  3. $target: the hit document.
  4. $handler: an optional parameters which defaults to default and it is handler name used in search.
Example:
try
{
  $source = [
    'id' => 1, // REQUIRED
    'title' => 'How to make italian pizza',
    'url' => 'https://funfunfood.com/2018/12/06/pizza',

    // OPTIONAL fields and only specified in source
    'user_id' => 2582,
    'user_ip' => '25.25.12.4',
    'country' => 'CA'
  ];

  $target = [
    'id' => 2, // REQUIRED
    'title' => 'How to make margherita',
    'url' => 'https://funfunfood.com/2018/12/06/margherita',

    // Only in target
    'item_order' => 1
  ];

  $response = $lableb->submitRecommendationFeedback( 'posts', $source, $target );
}
catch( \Lableb\Exceptions\LablebException $e )
{
  echo $e->getMessage();
}

Example response:
[
  'submitted' => true
]