Skip to content

Incorrect treating of string values in HTTP JSON responses #3392

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

Open
1 of 4 tasks
Nick-S-2018 opened this issue May 20, 2025 · 4 comments
Open
1 of 4 tasks

Incorrect treating of string values in HTTP JSON responses #3392

Nick-S-2018 opened this issue May 20, 2025 · 4 comments
Assignees
Labels

Comments

@Nick-S-2018
Copy link
Collaborator

Nick-S-2018 commented May 20, 2025

Bug Description:

Currently, daemon returns numeric values as numbers even if they were previously turned to strings by Buddy.

mysql -P9306 -h0 -v -e "drop table if exists my_index; create table my_index(f text) min_infix_len='2'; insert into my_index(f) values('helloer'),('12345')"; curl -s "0:9308/sql?mode=raw" -d "CALL AUTOCOMPLETE('hello', 'my_index', 1 as append)"|jq .; curl -s "0:9308/sql?mode=raw" -d "CALL AUTOCOMPLETE('123', 'my_index', 1 as append)"|jq .

Here is a response Buddy sends to daemon:

[BUDDY] [682aebd6d6f546.82980977] response data: {"version":3,"type":"sql response","message":[{"total":1,"error":"","warning":"","columns":[{"query":{"type":"string"}}],"data":[{"query":"12345"}]}],"meta":null,"error_code":200}

But after that the client still gets the following response from daemon

[
  {
    "total": 1,
    "error": "",
    "warning": "",
    "columns": [
      {
        "query": {
          "type": "string"
        }
      }
    ],
    "data": [
      {
        "query": 12345
      }
    ]
  }
]

The example can be reproduced with this Buddy branch

Manticore Search Version:

cfc5e39cc@25041016 dev

Operating System Version:

Ubuntu 22.04

Have you tried the latest development version?

None

Internal Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

  • Implementation completed
  • Tests developed
  • Documentation updated
  • Documentation reviewed
@Nick-S-2018
Copy link
Collaborator Author

Related to #3351

@tomatolog
Copy link
Contributor

I pushed the fix into the #3395 there removed auto-conversion on parsing Buddy reply with the JSON object

You could check it with your branch and merge if it works as you need.
I also wanted to notice that fix breaks CLT test test/clt-tests/kibana and result of that test should be fixed if the change got merged

Copy link

Thanks for the update! However, the internal checklist is not yet complete. A Manticore team member will close this issue once everything is checked off. 🛠️

@tomatolog
Copy link
Contributor

I've just merged the fix into master at 3df32f5

Now autoconversion of the buddy reply left only for endpoint started with _ ( _search. _bulk ). For all other replies JSON object parsed as is.

@tomatolog tomatolog assigned Nick-S-2018 and unassigned tomatolog May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants