Skip to content

Commit

Permalink
Substitute special characters to fix issues when searching the elasti…
Browse files Browse the repository at this point in the history
…csearch index.
  • Loading branch information
blackjk3 committed Oct 27, 2015
1 parent 49e6dae commit 5552c81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/studies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def index
# @trials = phrase_search
# else
params[:search][:q] = replace_words(search_parameters[:q])
search_parameters[:q] = params[:search][:q]

@trials = StudyFinder::Trial.match_all_search(search_parameters).page(params[:page]).results
# if match_all.total == 0
# @trials = StudyFinder::Trial.match_synonyms(params[:search]).page(params[:page]).results
Expand Down Expand Up @@ -69,6 +71,6 @@ def email_me

private
def replace_words(q)
q.gsub('head ache', 'headache')
q.gsub('head ache', 'headache').gsub('/', ' ').gsub('"', ' ')
end
end

0 comments on commit 5552c81

Please sign in to comment.