$config = ['host'=>'manticore','port'=>9308]
$client = new Client($config);
$suggest = $client->index('suggest');
$suggest->create([
'explanation' => [
'type' => 'text',
],
],
[
'min_infix_len' => 1,
'dict' => 'keywords',
]);
$suggest->addDocument([
'explanation' => 'Автобус',
]);
$query = [
'index' => 'suggest',
'body' => [
'query' => 'овтобус',
'options' => [
'limit' => 1,
],
],
];
$r = $client->suggest($query);
mysql> drop table if exists suggest; create table suggest(explanation text) min_infix_len='1' dict='keywords'; insert into suggest values(0,'Автобус'); call suggest('овтобус', 'suggest', 1 as limit);
Query OK, 0 rows affected (0.05 sec)
Query OK, 0 rows affected, 1 warning (0.01 sec)
Query OK, 1 row affected (0.02 sec)
+----------------+----------+------+
| suggest | distance | docs |
+----------------+----------+------+
| автобус | 1 | 1 |
+----------------+----------+------+
1 row in set (0.00 sec)