Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DenisAlliswell opened this issue May 23, 2022 · 2 comments
Closed

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

DenisAlliswell opened this issue May 23, 2022 · 2 comments

Comments

@DenisAlliswell
Copy link

DenisAlliswell commented May 23, 2022

Hello! First of all, thanks for the awesome tool and great job to all of the 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.

@DenisAlliswell DenisAlliswell changed the title Error on JSON decode after keyword request Error on JSON decode after keywords request ("\x03" symbol) May 23, 2022
@tomatolog
Copy link

seems daemon passes keyword from dictionary as is into HTTP reply however fixes up keyword when passes it into API and SphinxQL

Should be fixed at Manticore searchd binary but not at this library

@sanikolaev
Copy link
Collaborator

The root cause is manticoresoftware/manticoresearch#788. As soon as that's fixed this issue should be gone too, so I'm closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants