clear-code / redmine_full_text_search

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

Search for "rms" results in a 500 error #95

Closed petemcdonnell closed 3 years ago

petemcdonnell commented 3 years ago

We are using redmine version 4.1.1 and the redmine_full_text_search plugin version 1.0.4.

I know this term exists in our redmine data, I've tried numerous other search terms, both three char and longer with no issue. I have noticed that if I check the 'search subject only' OR the 'open issues only', I don't get the error.

How can I determine more information about this problem?

From the redmine production.log:

Started GET "/search?utf8=%E2%9C%93&q=rms&button=&scope=all&titles_only=0&open_issues=0&attachments=1&order_target=score&order_type=desc&options=0&search_id=1600364957.3081405&issues=1&news=1&documents=1&changesets=1&wiki_pages=1&messages=1&projects=1&changes=1" for 172.16.42.120 at 2020-09-17 13:49:28 -0400
Processing by SearchController#index as HTML
  Parameters: {"utf8"=>"✓", "q"=>"rms", "button"=>"", "scope"=>"all", "titles_only"=>"0", "open_issues"=>"0", "attachments"=>"1", "order_target"=>"score", "order_type"=>"desc", "options"=>"0", "search_id"=>"1600364957.3081405", "issues"=>"1", "news"=>"1", "documents"=>"1", "changesets"=>"1", "wiki_pages"=>"1", "messages"=>"1", "projects"=>"1", "changes"=>"1"}
  Current user: my.username (id=444)
[full-text-search][search] {"search_id":"1600364957.3081405","q":"rms","scope":"all","all_words":"1","titles_only":"0","attachments":"1","open_issues":"0","offset":0,"limit":10,"order_target":"score","order_type":"desc","options":"0","issues":"1","news":"1","documents":"1","changesets":"1","wiki_pages":"1","messages":"1","projects":"1","changes":"1","tags":[],"user_id":4,"project_id":null,"n_hits":3512,"total_n_hits":3512,"elapsed_time":0.09812164306640625,"timestamp":"2020-09-17T17:49:28Z"}
  Rendering plugins/full_text_search/app/views/search/index.html.erb within layouts/base
  Rendered plugins/full_text_search/app/views/search/index.html.erb within layouts/base (104.9ms)
Completed 500 Internal Server Error in 251ms (ActiveRecord: 142.5ms)

ActiveRecord::RecordNotFound (Couldn't find User with 'id'=13 [WHERE `users`.`type` IN ('User', 'AnonymousUser')]):

I'm not sure why it's referncing a user ID 13 - we don't have a user ID 13 that is visible in the user management screen.

kou commented 3 years ago

It's occurred when an item that refers a destroyed user. Did you destroy the 13 user?

Anyway, I've changed to ignore the destroyed data.