manticoresoftware / manticoresoftware/manticoresearch-python

Invalid characters in MC break search API

Open
#10 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
62
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Adding messages like this to MC seems to break the ability of the client to fetch them:
'msg': '[\x02L\u200bi\u200bl\u200bB\u200br\u200bu\u200bc\u200be\x02] sss'

Indexing with the client works fine:
{'error': None,
'items': [{'bulk': {'_id': 1370872170497990695,
'_index': 'main',
'created': 1,
'deleted': 0,
'result': 'created',
'status': 201,
'updated': 0}}]}

However, on search, these are the results:
{'took': None, 'timed_out': None, 'aggregations': None, 'hits': None, 'profile': None, 'warning': None}

In the server query log at the same time, I can see that this did in fact return results the client is not displaying.
/* Thu Sep 8 14:54:48.419 2022 conn 2 real 0.001 wall 0.002 found 73

Using requests seems to work:
response = requests.post(f"{settings.MANTICORE_URL}/json/search", json=search_query)
response = ujson.loads(response.text)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the search request with the message containing control and zero-width characters, comparing the Python client's response with the working requests and ujson path shown in the issue. Trace how the client parses the search response and verify that the returned hits are exposed instead of becoming None.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.