clear-code / redmine_full_text_search

Full text search for Redmine
MIT License
61 stars 24 forks source link

Syntax error query causes 500 server error #91

Closed petemcdonnell closed 4 years ago

petemcdonnell commented 4 years ago

Brackets (parenthesis) in the search term aren't properly handled?

Resulted in a 500 sever error...

From the redmine log:

Started GET "/projects/customers/search?utf8=%E2%9C%93&q=%28my+search+term&button=&scope=&titles_only=0&open_issues=0&attachments=1&order_target=score&order_type=desc&options=0&search_id=1593002991.1595986&issues=1" for my.ip.address.here at 2020-06-22 09:51:22 -0100 Processing by SearchController#index as HTML Parameters: {"utf8"=>"✓", "q"=>"(my search term", "button"=>"", "scope"=>"", "titles_only"=>"0", "open_issues"=>"0", "attachments"=>"1", "order_target"=>"score", "order_type"=>"desc", "options"=>"0", "search_id"=>"1593002991.1595986", "issues"=>"1", "id"=>"customers"} Current user: my.user (id=77) Completed 500 Internal Server Error in 24ms (ActiveRecord: 9.9ms)

ActiveRecord::StatementInvalid (Mysql2::Error: failed to parse fulltext search keyword: <(my search term>: <Syntax error: <(my search term||>>: SELECTfts_tags.idFROMfts_tagsWHEREfts_tags.type_id= 1 AND (MATCH (name) AGAINST ('(my search term' IN BOOLEAN MODE))):

kou commented 4 years ago

Thanks for your report. I've fixed this.