Error on JSON decode after keywords request ("\x03" symbol)

Hello! First of all, thanks for the awesome tool and great job to all of Manticoresearch team !

Below’s my index settings:

$index->create([
    'db_id' => ['type' => 'int'],
    'name_full' => ['type' => 'text'],
], [
    'morphology' => '',
    'bigram_index' => 'all',
    'min_infix_len' => 2,
    'index_exact_words' => 1,
    'expand_keywords' => 1,
]);

$id = 1;
$name_full = "Some long product name...";

$index->addDocument([
    'db_id' => (int) $id,
    'name_full' => (string) $name_full,
]);

$keywords = $client->keywords([
    'index' => $indexName,
    'body' => [
        'query' => "$term*",
        'options' => ['stats' => 1, 'sort_mode' => "'hits'"]
    ]
]);

After request on keywords I got this error:

Manticoresearch\Exceptions\RuntimeException: fatal error while trying to decode JSON response in /app/vendor/manticoresoftware/manticoresearch-php/src/Manticoresearch/Response.php:76
Stack trace:
#0 /app/vendor/manticoresoftware/manticoresearch-php/src/Manticoresearch/Response/SqlToArray.php(11): Manticoresearch\Response->getResponse()
#1 /app/vendor/manticoresoftware/manticoresearch-php/src/Manticoresearch/Response.php(92): Manticoresearch\Response\SqlToArray->getResponse()
#2 /app/vendor/manticoresoftware/manticoresearch-php/src/Manticoresearch/Transport/Http.php(124): Manticoresearch\Response->hasError()
#3 /app/vendor/manticoresoftware/manticoresearch-php/src/Manticoresearch/Client.php(353): Manticoresearch\Transport\Http->execute()
#4 /app/vendor/manticoresoftware/manticoresearch-php/src/Manticoresearch/Client.php(325): Manticoresearch\Client->request()
#5 /app/backend/controllers/TestController.php(591): Manticoresearch\Client->keywords()

Here’s the raw response result:

{"columns":[{"qpos":{"type":"string"}},{"tokenized":{"type":"string"}},{"normalized":{"type":"string"}},{"docs":{"type":"string"}},{"hits":{"type":"string"}}],\
"data":[\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтер", "docs":"1148", "hits":"1153"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтер\x03этикеток", "docs":"404", "hits":"404"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтера", "docs":"25", "hits":"25"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтера\x03aura", "docs":"13", "hits":"13"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтер\x03canon", "docs":"7", "hits":"7"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтер\x03hp", "docs":"5", "hits":"5"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтер\x03xerox", "docs":"5", "hits":"5"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтер\x03epson", "docs":"3", "hits":"3"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтера\x03tdp", "docs":"3", "hits":"3"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтера\x03tsc", "docs":"3", "hits":"3"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтеров", "docs":"3", "hits":"3"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтер\x03kyocera", "docs":"2", "hits":"2"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтера\x03pp", "docs":"2", "hits":"2"},\n
{"qpos":"1", "tokenized":"принт*", "normalized":"=принтера\x03tтp", "docs":"2", "hits":"2"},\n
],\n
"total":0,\n
"error":"",\n
"warning":""\n

It seems that issue is related to “\x03” symbol. For some reason, Manticore puts it instead of whitespace.

Hi. I’ve replied in the original ticket on GitHub - https://github.com/manticoresoftware/manticoresearch-php/issues/91

1 Like