Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions app/controllers/messages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ def search(query)

# %> and <-> are defined by pg_trgm.
# https://www.postgresql.org/docs/17/pgtrgm.html
message_where = if Rails.env.production?
Message.where('body %> ? AND list_id IN (?)', query, list_ids)
.order(Arel.sql('body <-> ?', query))
else
Message.where('body LIKE ? AND list_id IN (?)', "%#{query}%", list_ids)
end
message_where = Message.where('body %> ? AND list_id IN (?)', query, list_ids).order(Arel.sql('body <-> ?', query))
@messages = message_where.offset(page * PER_PAGE).limit(PER_PAGE)
end
end