diff --git a/app/controllers/searches_controller.rb b/app/controllers/searches_controller.rb index 7e91d253..c3243668 100644 --- a/app/controllers/searches_controller.rb +++ b/app/controllers/searches_controller.rb @@ -10,7 +10,7 @@ def show cond_text = filter_names.map{|w| "LOWER(entries.body) like ?"}.join(" OR ") cond_values = filter_names.map{|w| "%#{w}%"} @entries = current_user.entries.where(cond_text, *cond_values) - elsif search_params[:term].include?('"') + elsif search_params[:term].present? && search_params[:term].include?('"') exact_phrase = search_params[:term].delete('"') @entries = current_user.entries.where("entries.body ~* ?", "\\m#{exact_phrase}\\M") else