The following CALL PQ uses an expression parser (as the SQL parser doesn't know about '=='). This results in string comparison expression comparing JSON_TRUE that can't be converted into a string (and StringEval returns 0) and an empty const string (StringEval returns 0 again). String comparison assumes that they are equal empty strings and returns 1 as a result which is wrong.
drop table if exists pq;
create table pq (`json` json) type='pq';
INSERT INTO pq (query, filters) VALUES ('', 'json.target.`wpcom:blog_id`==\'\'');
call pq ('pq', '{"text":"filter test", "json":{"target":{"wpcom:blog_id":true}}}', 1 as docs_json);
The following CALL PQ uses a SQL parser; it spawns a Expr_JsonFieldIn_c which knows the types of data it is comparing. As JSON_TRUE is not a string, this always returns 0 which is expected.
drop table if exists pq;
create table pq (`json` json) type='pq';
INSERT INTO pq (query, filters) VALUES ('', 'json.target.`wpcom:blog_id`=\'\'');
call pq ('pq', '{"text":"filter test", "json":{"target":{"wpcom:blog_id":true}}}', 1 as docs_json);
Manticore Search Version:
6.3.1
Operating System Version:
Any
Have you tried the latest development version?
Yes
Internal Checklist:
To be completed by the assignee. Check off tasks that have been completed or are not applicable.
Bug Description:
The following
CALL PQ
uses an expression parser (as the SQL parser doesn't know about '=='). This results in string comparison expression comparing JSON_TRUE that can't be converted into a string (and StringEval returns 0) and an empty const string (StringEval returns 0 again). String comparison assumes that they are equal empty strings and returns 1 as a result which is wrong.The following
CALL PQ
uses a SQL parser; it spawns a Expr_JsonFieldIn_c which knows the types of data it is comparing. As JSON_TRUE is not a string, this always returns 0 which is expected.Manticore Search Version:
6.3.1
Operating System Version:
Any
Have you tried the latest development version?
Yes
Internal Checklist:
To be completed by the assignee. Check off tasks that have been completed or are not applicable.