Notice !

Results are cached for 10 minutes and changes (like updating a document) will not be applied for the same query until 10 minutes pass.
$lableb->autocomplete( $collection, $queryOptions, [$handler] )
  1. $collection: collection name you want to search for suggestions in.
  2. $queryOptions: an associatve array with search parameters.
  3. $handler: an optional parameter that has the value of suggest by default, specify it if you want to use a custom autocomplete handler.
Search Options (\$queryOptions):
qsearch termyes'how to ma'
limithow many documents to fetchno5
user_ida unique user idno1254
user_ipuser IP addressno''
user_countryuser country codeno'CA'
You can specify any additional query string parameters if you need to.
  $response = $lableb->autocomplete( 'posts', [
    'q' => 'how to ma'
  ] );
catch ( \Lableb\LablebException $e )
  echo $e->getMessage();

Example response:

Notice !

There are two types of suggestions. Navigational suggestion which refers to an article and a Filter suggestion which has search filters that can be used with search

Notice !

Each result will have an additional field called feedbackUrl which you can perform a GET request on to submit autocomplete feedback
  'totalSuggestions' => 33,
  'suggestions' => [
      'suggestion_type' => 'navigational',
      'id' => 1,
      'phrase' => 'How to make italian pizza',
      'date' => '2018-12-06T12:16:00.000+0000',
      'url' => 'https://funfunfood.com/2018/12/06/pizza',
      'feedbackUrl' => 'https://api-bahuth.lableb.com/api/v1/....'
      'suggestion_type' => 'filter',
      'phrase' => 'Posts about pizza',
      'filters' => [
        'meta_sa' => ['Pizza', 'Food']