Fix #4149: Add missing post search options on applicable models.

This commit is contained in:
evazion
2019-09-01 13:10:37 -05:00
parent 1bb1b147ea
commit 67100f26eb
26 changed files with 27 additions and 54 deletions

View File

@@ -53,13 +53,13 @@ class WikiPage < ApplicationRecord
def search(params = {})
q = super
q = q.search_attributes(params, :creator, :updater, :is_locked, :is_deleted, :body)
q = q.text_attribute_matches(:body, params[:body_matches], index_column: :body_index, ts_config: "danbooru")
if params[:title].present?
q = q.where("title LIKE ? ESCAPE E'\\\\'", params[:title].mb_chars.downcase.strip.tr(" ", "_").to_escaped_for_sql_like)
end
q = q.search_attributes(params, :creator, :is_locked, :is_deleted)
q = q.text_attribute_matches(:body, params[:body_matches], index_column: :body_index, ts_config: "danbooru")
if params[:other_names_match].present?
q = q.other_names_match(params[:other_names_match])
end