Skip to content

CALL AUTOCOMPLETE() sometimes produces a List<Map<String, String>>, sometimes List<Map<String, Int>> in JSON results #3351

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
4 tasks
Ocramius opened this issue May 2, 2025 · 1 comment
Assignees
Labels

Comments

@Ocramius
Copy link

Ocramius commented May 2, 2025

Bug Description:

Given following SQL query:

CALL AUTOCOMPLETE('hello', 'my_index', 1 as append);

When using the /sql endpoint, Manticore will respond with data such as [{"query": "hello"}, {"query": "helloer"}]

When using a numeric value, things change:

CALL AUTOCOMPLETE('123', 'my_index', 1 as append);

When using the /sql endpoint, Manticore will respond with data such as [{"query": 123}, {"query": 12345}]

It seems like some auto-magic casting is occurring? Is that intentional?

Manticore Search Version:

7.4.6

Operating System Version:

irrelevant

Have you tried the latest development version?

No

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
@Ocramius Ocramius added the bug label May 2, 2025
@Ocramius Ocramius changed the title CALL AUTOCOMPLETE() sometimes produces a List<Map<String, String>>, sometimes List<Map<String, Int>> in JSOn results CALL AUTOCOMPLETE() sometimes produces a List<Map<String, String>>, sometimes List<Map<String, Int>> in JSON results May 2, 2025
@sanikolaev
Copy link
Collaborator

Thanks for the issue @Ocramius . I don't think the casting is intentional.

MRE:

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 .
--------------
drop table if exists my_index
--------------

--------------
create table my_index(f text) min_infix_len='2'
--------------

--------------
insert into my_index(f) values('helloer'),('12345')
--------------

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

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

3 participants