Skip to content

Commit

Permalink
Use un-escaped tag for db query
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjaustin committed Apr 6, 2024
1 parent 9611cc3 commit 5929143
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/controllers/autocomplete_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,13 @@ def noncanonical_tag
raise "Redshirt: Attempted to constantize invalid class initialize noncanonical_tag #{params[:type].classify}" unless Tag::TYPES.include?(params[:type].classify)

tag_class = params[:type].classify.constantize
one_tag = tag_class.find_by(canonical: false, name: search_param)
# Is there a tag which is just right ( this is really for testing )
match = if one_tag then [one_tag.name] else [] end # rubocop:disable Style/OneLineConditional
one_tag = tag_class.find_by(canonical: false, name: params[:term])
# Is there a tag which is just right (this is really for testing)
match = if one_tag
[one_tag.name]
else
[]
end

# As explained in https://stackoverflow.com/a/54080114, the Elasticsearch suggestion suggester does not support
# matches in the middle of a series of words. Therefore, we break the autocomplete query into its individual
Expand Down

0 comments on commit 5929143

Please sign in to comment.