query-parser icon indicating copy to clipboard operation
query-parser copied to clipboard

chunk + to_h not working as expected

Open schneikai opened this issue 6 years ago • 1 comments

hey @look, enjoyed your article and used some of your code in own project. Thank you so much! Just wanted to let you know about a possible small mistake here: https://github.com/look/query-parser/blob/6049469db352f937d0d88300dd0986b86b14e3b3/phrase_parser.rb#L71 chunk.to_h is only keeping the last element for each group in the array for each operator. To fix I used grouped = clauses.group_by(&:operator) instead. Ruby version is 2.1.0

schneikai avatar Mar 11 '19 04:03 schneikai

Thanks for the report! I'll take a look and update the code.

look avatar Mar 31 '19 00:03 look