diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb index b237c8e7..41ffa692 100644 --- a/app/controllers/entries_controller.rb +++ b/app/controllers/entries_controller.rb @@ -217,6 +217,10 @@ def export 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].present? && search_params[:term].include?('"') + @search = Search.new(search_params) + exact_phrase = search_params[:term].delete('"') + @entries = current_user.entries.where("entries.body ~* ?", "\\m#{exact_phrase}\\M") elsif search_params[:term].present? @search = Search.new(search_params) @entries = @search.entries diff --git a/app/controllers/searches_controller.rb b/app/controllers/searches_controller.rb index c3243668..2df1d300 100644 --- a/app/controllers/searches_controller.rb +++ b/app/controllers/searches_controller.rb @@ -11,6 +11,7 @@ def show cond_values = filter_names.map{|w| "%#{w}%"} @entries = current_user.entries.where(cond_text, *cond_values) elsif search_params[:term].present? && search_params[:term].include?('"') + @search = Search.new(search_params) exact_phrase = search_params[:term].delete('"') @entries = current_user.entries.where("entries.body ~* ?", "\\m#{exact_phrase}\\M") else