diff --git a/app/logical/concerns/searchable.rb b/app/logical/concerns/searchable.rb index 4b64261eb..321d89a81 100644 --- a/app/logical/concerns/searchable.rb +++ b/app/logical/concerns/searchable.rb @@ -155,6 +155,7 @@ module Searchable indifferent_params = params.try(:with_indifferent_access) || params.try(:to_unsafe_h) raise ArgumentError, "unable to process params" if indifferent_params.nil? + attributes += searchable_includes attributes.reduce(all) do |relation, attribute| relation.search_attribute(attribute, indifferent_params, CurrentUser.user) end @@ -406,14 +407,6 @@ module Searchable where(id: ids).order(Arel.sql(order_clause.join(', '))) end - def search(params = {}) - params ||= {} - - default_attributes = (attribute_names.map(&:to_sym) & %i[id created_at updated_at]) - all_attributes = default_attributes + searchable_includes - search_attributes(params, *all_attributes) - end - private def qualified_column_for(attr) diff --git a/app/models/artist.rb b/app/models/artist.rb index 6a2222c65..9ee09c407 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -250,9 +250,7 @@ class Artist < ApplicationRecord end def search(params) - q = super - - q = q.search_attributes(params, :is_deleted, :is_banned, :name, :group_name, :other_names) + q = search_attributes(params, :id, :created_at, :updated_at, :is_deleted, :is_banned, :name, :group_name, :other_names) if params[:any_other_name_like] q = q.any_other_name_like(params[:any_other_name_like]) diff --git a/app/models/artist_commentary.rb b/app/models/artist_commentary.rb index d94939d22..1ea297c62 100644 --- a/app/models/artist_commentary.rb +++ b/app/models/artist_commentary.rb @@ -31,9 +31,7 @@ class ArtistCommentary < ApplicationRecord end def search(params) - q = super - - q = q.search_attributes(params, :original_title, :original_description, :translated_title, :translated_description) + q = search_attributes(params, :id, :created_at, :updated_at, :original_title, :original_description, :translated_title, :translated_description) if params[:text_matches].present? q = q.text_matches(params[:text_matches]) diff --git a/app/models/artist_commentary_version.rb b/app/models/artist_commentary_version.rb index 1bf34aa02..c9fcb9a49 100644 --- a/app/models/artist_commentary_version.rb +++ b/app/models/artist_commentary_version.rb @@ -12,8 +12,7 @@ class ArtistCommentaryVersion < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :original_title, :original_description, :translated_title, :translated_description) + q = search_attributes(params, :id, :created_at, :updated_at, :original_title, :original_description, :translated_title, :translated_description) if params[:text_matches].present? q = q.text_matches(params[:text_matches]) diff --git a/app/models/artist_url.rb b/app/models/artist_url.rb index bab5e04c3..bd17c7358 100644 --- a/app/models/artist_url.rb +++ b/app/models/artist_url.rb @@ -40,9 +40,7 @@ class ArtistUrl < ApplicationRecord end def self.search(params = {}) - q = super - - q = q.search_attributes(params, :url, :normalized_url, :is_active) + q = search_attributes(params, :id, :created_at, :updated_at, :url, :normalized_url, :is_active) q = q.url_matches(params[:url_matches]) q = q.normalized_url_matches(params[:normalized_url_matches]) diff --git a/app/models/artist_version.rb b/app/models/artist_version.rb index 19d608e6b..c7af5690a 100644 --- a/app/models/artist_version.rb +++ b/app/models/artist_version.rb @@ -7,9 +7,7 @@ class ArtistVersion < ApplicationRecord module SearchMethods def search(params) - q = super - - q = q.search_attributes(params, :is_deleted, :is_banned, :name, :group_name, :urls, :other_names) + q = search_attributes(params, :id, :created_at, :updated_at, :is_deleted, :is_banned, :name, :group_name, :urls, :other_names) q = q.text_attribute_matches(:name, params[:name_matches]) q = q.text_attribute_matches(:group_name, params[:group_name_matches]) diff --git a/app/models/ban.rb b/app/models/ban.rb index 4d91d04ae..6417ba739 100644 --- a/app/models/ban.rb +++ b/app/models/ban.rb @@ -20,9 +20,7 @@ class Ban < ApplicationRecord end def self.search(params) - q = super - - q = q.search_attributes(params, :expires_at, :reason) + q = search_attributes(params, :id, :created_at, :updated_at, :expires_at, :reason) q = q.text_attribute_matches(:reason, params[:reason_matches]) q = q.expired if params[:expired].to_s.truthy? diff --git a/app/models/bulk_update_request.rb b/app/models/bulk_update_request.rb index b42539011..a189fe72a 100644 --- a/app/models/bulk_update_request.rb +++ b/app/models/bulk_update_request.rb @@ -31,9 +31,7 @@ class BulkUpdateRequest < ApplicationRecord end def search(params = {}) - q = super - - q = q.search_attributes(params, :script, :tags) + q = search_attributes(params, :id, :created_at, :updated_at, :script, :tags) q = q.text_attribute_matches(:script, params[:script_matches]) if params[:status].present? diff --git a/app/models/comment.rb b/app/models/comment.rb index 0c4fd1f8d..71f23b698 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -26,9 +26,7 @@ class Comment < ApplicationRecord module SearchMethods def search(params) - q = super - - q = q.search_attributes(params, :is_deleted, :is_sticky, :do_not_bump_post, :body, :score) + q = search_attributes(params, :id, :created_at, :updated_at, :is_deleted, :is_sticky, :do_not_bump_post, :body, :score) q = q.text_attribute_matches(:body, params[:body_matches], index_column: :body_index) case params[:order] diff --git a/app/models/comment_vote.rb b/app/models/comment_vote.rb index e44818f63..bb1fa3ca8 100644 --- a/app/models/comment_vote.rb +++ b/app/models/comment_vote.rb @@ -19,8 +19,7 @@ class CommentVote < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :score) + q = search_attributes(params, :id, :created_at, :updated_at, :score) q.apply_default_order(params) end diff --git a/app/models/dmail.rb b/app/models/dmail.rb index e3885c236..a5c945f89 100644 --- a/app/models/dmail.rb +++ b/app/models/dmail.rb @@ -98,9 +98,7 @@ class Dmail < ApplicationRecord end def search(params) - q = super - - q = q.search_attributes(params, :is_read, :is_deleted, :title, :body) + q = search_attributes(params, :id, :created_at, :updated_at, :is_read, :is_deleted, :title, :body) q = q.text_attribute_matches(:title, params[:title_matches]) q = q.text_attribute_matches(:body, params[:message_matches], index_column: :message_index) diff --git a/app/models/dtext_link.rb b/app/models/dtext_link.rb index ea4902d53..9be3cc6b3 100644 --- a/app/models/dtext_link.rb +++ b/app/models/dtext_link.rb @@ -30,8 +30,7 @@ class DtextLink < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :link_type, :link_target) + q = search_attributes(params, :id, :created_at, :updated_at, :link_type, :link_target) q.apply_default_order(params) end diff --git a/app/models/email_address.rb b/app/models/email_address.rb index 9d4dd6f22..ffe6175f1 100644 --- a/app/models/email_address.rb +++ b/app/models/email_address.rb @@ -38,9 +38,7 @@ class EmailAddress < ApplicationRecord end def self.search(params) - q = super - - q = q.search_attributes(params, :user, :address, :normalized_address, :is_verified, :is_deliverable) + q = search_attributes(params, :id, :created_at, :updated_at, :user, :address, :normalized_address, :is_verified, :is_deliverable) q = q.apply_default_order(params) q diff --git a/app/models/favorite.rb b/app/models/favorite.rb index a5488f3fd..f6ce651bd 100644 --- a/app/models/favorite.rb +++ b/app/models/favorite.rb @@ -12,8 +12,7 @@ class Favorite < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :post) + q = search_attributes(params, :id, :post) if params[:user_id].present? q = q.for_user(params[:user_id]) diff --git a/app/models/favorite_group.rb b/app/models/favorite_group.rb index e34ef706b..45040b79f 100644 --- a/app/models/favorite_group.rb +++ b/app/models/favorite_group.rb @@ -26,8 +26,7 @@ class FavoriteGroup < ApplicationRecord end def search(params) - q = super - q = q.search_attributes(params, :name, :is_public, :post_ids) + q = search_attributes(params, :id, :created_at, :updated_at, :name, :is_public, :post_ids) if params[:name_matches].present? q = q.name_matches(params[:name_matches]) diff --git a/app/models/forum_post.rb b/app/models/forum_post.rb index 2558a33ce..0d05876b2 100644 --- a/app/models/forum_post.rb +++ b/app/models/forum_post.rb @@ -41,8 +41,7 @@ class ForumPost < ApplicationRecord end def search(params) - q = super - q = q.search_attributes(params, :is_deleted, :body) + q = search_attributes(params, :id, :created_at, :updated_at, :is_deleted, :body) q = q.text_attribute_matches(:body, params[:body_matches], index_column: :text_index) if params[:linked_to].present? diff --git a/app/models/forum_post_vote.rb b/app/models/forum_post_vote.rb index 3ea592389..7e36cd879 100644 --- a/app/models/forum_post_vote.rb +++ b/app/models/forum_post_vote.rb @@ -19,8 +19,7 @@ class ForumPostVote < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :score) + q = search_attributes(params, :id, :created_at, :updated_at, :score) q = q.forum_post_matches(params[:forum_post]) q.apply_default_order(params) end diff --git a/app/models/forum_topic.rb b/app/models/forum_topic.rb index f44a727d6..f70a02af6 100644 --- a/app/models/forum_topic.rb +++ b/app/models/forum_topic.rb @@ -86,8 +86,7 @@ class ForumTopic < ApplicationRecord end def search(params) - q = super - q = q.search_attributes(params, :is_sticky, :is_locked, :is_deleted, :category_id, :title, :response_count) + q = search_attributes(params, :id, :created_at, :updated_at, :is_sticky, :is_locked, :is_deleted, :category_id, :title, :response_count) q = q.text_attribute_matches(:title, params[:title_matches], index_column: :text_index) if params[:is_private].to_s.truthy? diff --git a/app/models/forum_topic_visit.rb b/app/models/forum_topic_visit.rb index 531f37f39..8fe1ac8ac 100644 --- a/app/models/forum_topic_visit.rb +++ b/app/models/forum_topic_visit.rb @@ -7,8 +7,7 @@ class ForumTopicVisit < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :user, :forum_topic_id, :last_read_at) + q = search_attributes(params, :id, :created_at, :updated_at, :user, :forum_topic_id, :last_read_at) q.apply_default_order(params) end end diff --git a/app/models/ip_address.rb b/app/models/ip_address.rb index 322de5167..0e286f7f4 100644 --- a/app/models/ip_address.rb +++ b/app/models/ip_address.rb @@ -12,8 +12,7 @@ class IpAddress < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :ip_addr) + q = search_attributes(params, :ip_addr) q.order(created_at: :desc) end diff --git a/app/models/ip_ban.rb b/app/models/ip_ban.rb index 76b3b7c05..1182bef54 100644 --- a/app/models/ip_ban.rb +++ b/app/models/ip_ban.rb @@ -25,8 +25,7 @@ class IpBan < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :reason) + q = search_attributes(params, :id, :created_at, :updated_at, :reason) q = q.text_attribute_matches(:reason, params[:reason_matches]) if params[:ip_addr].present? diff --git a/app/models/mod_action.rb b/app/models/mod_action.rb index 87fbfda97..7d0b73615 100644 --- a/app/models/mod_action.rb +++ b/app/models/mod_action.rb @@ -61,9 +61,7 @@ class ModAction < ApplicationRecord end def self.search(params) - q = super - - q = q.search_attributes(params, :category, :description) + q = search_attributes(params, :id, :created_at, :updated_at, :category, :description) q = q.text_attribute_matches(:description, params[:description_matches]) q.apply_default_order(params) diff --git a/app/models/moderation_report.rb b/app/models/moderation_report.rb index 4fa1f77de..9916154cd 100644 --- a/app/models/moderation_report.rb +++ b/app/models/moderation_report.rb @@ -82,8 +82,7 @@ class ModerationReport < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :reason) + q = search_attributes(params, :id, :created_at, :updated_at, :reason) q = q.text_attribute_matches(:reason, params[:reason_matches]) q.apply_default_order(params) diff --git a/app/models/note.rb b/app/models/note.rb index 3cb745da7..431161e5f 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -14,9 +14,7 @@ class Note < ApplicationRecord module SearchMethods def search(params) - q = super - - q = q.search_attributes(params, :is_active, :x, :y, :width, :height, :body, :version) + q = search_attributes(params, :id, :created_at, :updated_at, :is_active, :x, :y, :width, :height, :body, :version) q = q.text_attribute_matches(:body, params[:body_matches], index_column: :body_index) q.apply_default_order(params) diff --git a/app/models/note_version.rb b/app/models/note_version.rb index d8c3aed07..310e0ef16 100644 --- a/app/models/note_version.rb +++ b/app/models/note_version.rb @@ -4,9 +4,7 @@ class NoteVersion < ApplicationRecord belongs_to_updater :counter_cache => "note_update_count" def self.search(params) - q = super - - q = q.search_attributes(params, :is_active, :x, :y, :width, :height, :body, :version) + q = search_attributes(params, :id, :created_at, :updated_at, :is_active, :x, :y, :width, :height, :body, :version) q = q.text_attribute_matches(:body, params[:body_matches]) q.apply_default_order(params) diff --git a/app/models/pixiv_ugoira_frame_data.rb b/app/models/pixiv_ugoira_frame_data.rb index 92c1eba2b..8c35a9387 100644 --- a/app/models/pixiv_ugoira_frame_data.rb +++ b/app/models/pixiv_ugoira_frame_data.rb @@ -13,8 +13,7 @@ class PixivUgoiraFrameData < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :data, :content_type) + q = search_attributes(params, :id, :data, :content_type) q.apply_default_order(params) end diff --git a/app/models/pool.rb b/app/models/pool.rb index 4c3f59e9d..547c8e295 100644 --- a/app/models/pool.rb +++ b/app/models/pool.rb @@ -36,9 +36,7 @@ class Pool < ApplicationRecord end def search(params) - q = super - - q = q.search_attributes(params, :is_deleted, :name, :description, :post_ids) + q = search_attributes(params, :id, :created_at, :updated_at, :is_deleted, :name, :description, :post_ids) q = q.text_attribute_matches(:description, params[:description_matches]) if params[:post_tags_match] diff --git a/app/models/pool_version.rb b/app/models/pool_version.rb index 1bf6f3cb6..671f7c982 100644 --- a/app/models/pool_version.rb +++ b/app/models/pool_version.rb @@ -32,8 +32,7 @@ class PoolVersion < ApplicationRecord end def search(params) - q = super - q = q.search_attributes(params, :pool_id, :post_ids, :added_post_ids, :removed_post_ids, :updater_id, :description, :description_changed, :name, :name_changed, :version, :is_active, :is_deleted, :category) + q = search_attributes(params, :id, :created_at, :updated_at, :pool_id, :post_ids, :added_post_ids, :removed_post_ids, :updater_id, :description, :description_changed, :name, :name_changed, :version, :is_active, :is_deleted, :category) if params[:post_id] q = q.for_post_id(params[:post_id].to_i) diff --git a/app/models/post.rb b/app/models/post.rb index 6f54da31c..e4f1b5afe 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1289,14 +1289,14 @@ class Post < ApplicationRecord end def search(params) - q = super - - q = q.search_attributes( + q = search_attributes( params, - :rating, :source, :pixiv_id, :fav_count, :score, :up_score, :down_score, :md5, :file_ext, - :file_size, :image_width, :image_height, :tag_count, :has_children, :has_active_children, - :is_note_locked, :is_rating_locked, :is_status_locked, :is_pending, :is_flagged, :is_deleted, - :is_banned, :last_comment_bumped_at, :last_commented_at, :last_noted_at + :id, :created_at, :updated_at, :rating, :source, :pixiv_id, :fav_count, + :score, :up_score, :down_score, :md5, :file_ext, :file_size, :image_width, + :image_height, :tag_count, :has_children, :has_active_children, + :is_note_locked, :is_rating_locked, :is_status_locked, :is_pending, + :is_flagged, :is_deleted, :is_banned, :last_comment_bumped_at, + :last_commented_at, :last_noted_at, :uploader_ip_addr ) if params[:tags].present? diff --git a/app/models/post_appeal.rb b/app/models/post_appeal.rb index af54ce997..e8049e88c 100644 --- a/app/models/post_appeal.rb +++ b/app/models/post_appeal.rb @@ -17,8 +17,7 @@ class PostAppeal < ApplicationRecord module SearchMethods def search(params) - q = super - q = q.search_attributes(params, :reason, :status) + q = search_attributes(params, :id, :created_at, :updated_at, :reason, :status) q = q.text_attribute_matches(:reason, params[:reason_matches]) q.apply_default_order(params) diff --git a/app/models/post_approval.rb b/app/models/post_approval.rb index 599cd1ba9..127d49958 100644 --- a/app/models/post_approval.rb +++ b/app/models/post_approval.rb @@ -38,7 +38,7 @@ class PostApproval < ApplicationRecord end def self.search(params) - q = super + q = search_attributes(params, :id, :created_at, :updated_at, :post, :user) q.apply_default_order(params) end diff --git a/app/models/post_disapproval.rb b/app/models/post_disapproval.rb index 08fac4921..f08d318c9 100644 --- a/app/models/post_disapproval.rb +++ b/app/models/post_disapproval.rb @@ -21,9 +21,7 @@ class PostDisapproval < ApplicationRecord concerning :SearchMethods do class_methods do def search(params) - q = super - - q = q.search_attributes(params, :message, :reason) + q = search_attributes(params, :id, :created_at, :updated_at, :message, :reason) q = q.text_attribute_matches(:message, params[:message_matches]) q = q.with_message if params[:has_message].to_s.truthy? diff --git a/app/models/post_flag.rb b/app/models/post_flag.rb index 24493ba2f..3254f073c 100644 --- a/app/models/post_flag.rb +++ b/app/models/post_flag.rb @@ -56,9 +56,7 @@ class PostFlag < ApplicationRecord end def search(params) - q = super - - q = q.search_attributes(params, :reason, :status) + q = search_attributes(params, :id, :created_at, :updated_at, :reason, :status) q = q.text_attribute_matches(:reason, params[:reason_matches]) if params[:creator_id].present? diff --git a/app/models/post_replacement.rb b/app/models/post_replacement.rb index 35dd266a6..04e80a78d 100644 --- a/app/models/post_replacement.rb +++ b/app/models/post_replacement.rb @@ -21,8 +21,7 @@ class PostReplacement < ApplicationRecord concerning :Search do class_methods do def search(params = {}) - q = super - q = q.search_attributes(params, :md5, :md5_was, :file_ext, :file_ext_was, :original_url, :replacement_url) + q = search_attributes(params, :id, :created_at, :updated_at, :md5, :md5_was, :file_ext, :file_ext_was, :original_url, :replacement_url) q.apply_default_order(params) end end diff --git a/app/models/post_version.rb b/app/models/post_version.rb index 59bd38b83..3cb63ecb9 100644 --- a/app/models/post_version.rb +++ b/app/models/post_version.rb @@ -38,8 +38,7 @@ class PostVersion < ApplicationRecord end def search(params) - q = super - q = q.search_attributes(params, :updater_id, :post_id, :tags, :added_tags, :removed_tags, :rating, :rating_changed, :parent_id, :parent_changed, :source, :source_changed, :version) + q = search_attributes(params, :id, :updated_at, :updater_id, :post_id, :tags, :added_tags, :removed_tags, :rating, :rating_changed, :parent_id, :parent_changed, :source, :source_changed, :version) if params[:changed_tags] q = q.changed_tags_include_all(params[:changed_tags].scan(/[^[:space:]]+/)) diff --git a/app/models/post_vote.rb b/app/models/post_vote.rb index fdc9aa896..096b123df 100644 --- a/app/models/post_vote.rb +++ b/app/models/post_vote.rb @@ -19,8 +19,7 @@ class PostVote < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :score) + q = search_attributes(params, :id, :created_at, :updated_at, :score) q.apply_default_order(params) end diff --git a/app/models/saved_search.rb b/app/models/saved_search.rb index 8ab9aba52..e3dad2dc0 100644 --- a/app/models/saved_search.rb +++ b/app/models/saved_search.rb @@ -113,8 +113,7 @@ class SavedSearch < ApplicationRecord concerning :Search do class_methods do def search(params) - q = super - q = q.search_attributes(params, :query) + q = search_attributes(params, :id, :created_at, :updated_at, :query) if params[:label] q = q.labeled(params[:label]) diff --git a/app/models/tag.rb b/app/models/tag.rb index 3c3a3bf65..86fd3fb1e 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -271,9 +271,7 @@ class Tag < ApplicationRecord end def search(params) - q = super - - q = q.search_attributes(params, :is_locked, :category, :post_count, :name) + q = search_attributes(params, :id, :created_at, :updated_at, :is_locked, :category, :post_count, :name) if params[:fuzzy_name_matches].present? q = q.fuzzy_name_matches(params[:fuzzy_name_matches]) diff --git a/app/models/tag_relationship.rb b/app/models/tag_relationship.rb index 341f3182d..1d303b6e7 100644 --- a/app/models/tag_relationship.rb +++ b/app/models/tag_relationship.rb @@ -66,8 +66,7 @@ class TagRelationship < ApplicationRecord end def search(params) - q = super - q = q.search_attributes(params, :antecedent_name, :consequent_name) + q = search_attributes(params, :id, :created_at, :updated_at, :antecedent_name, :consequent_name) if params[:name_matches].present? q = q.name_matches(params[:name_matches]) diff --git a/app/models/upload.rb b/app/models/upload.rb index 04c61a078..383c59a65 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -182,9 +182,7 @@ class Upload < ApplicationRecord end def self.search(params) - q = super - - q = q.search_attributes(params, :source, :rating, :parent_id, :server, :md5, :server, :file_ext, :file_size, :image_width, :image_height, :referer_url) + q = search_attributes(params, :id, :created_at, :updated_at, :source, :rating, :parent_id, :server, :md5, :server, :file_ext, :file_size, :image_width, :image_height, :referer_url) if params[:source_matches].present? q = q.where_like(:source, params[:source_matches]) diff --git a/app/models/user.rb b/app/models/user.rb index 7ac2d8aea..ee0603a16 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -560,12 +560,10 @@ class User < ApplicationRecord module SearchMethods def search(params) - q = super - params = params.dup params[:name_matches] = params.delete(:name) if params[:name].present? - q = q.search_attributes(params, :name, :level, :post_upload_count, :post_update_count, :note_update_count, :favorite_count) + q = search_attributes(params, :id, :created_at, :updated_at, :name, :level, :post_upload_count, :post_update_count, :note_update_count, :favorite_count) if params[:name_matches].present? q = q.where_ilike(:name, normalize_name(params[:name_matches])) diff --git a/app/models/user_feedback.rb b/app/models/user_feedback.rb index eaf24fcf4..f52d0d856 100644 --- a/app/models/user_feedback.rb +++ b/app/models/user_feedback.rb @@ -30,9 +30,7 @@ class UserFeedback < ApplicationRecord end def search(params) - q = super - - q = q.search_attributes(params, :category, :body, :is_deleted) + q = search_attributes(params, :id, :created_at, :updated_at, :category, :body, :is_deleted) q = q.text_attribute_matches(:body, params[:body_matches]) q.apply_default_order(params) diff --git a/app/models/user_name_change_request.rb b/app/models/user_name_change_request.rb index c3261e000..9b6b69e2b 100644 --- a/app/models/user_name_change_request.rb +++ b/app/models/user_name_change_request.rb @@ -19,8 +19,7 @@ class UserNameChangeRequest < ApplicationRecord end def self.search(params) - q = super - q = q.search_attributes(params, :user, :original_name, :desired_name) + q = search_attributes(params, :id, :created_at, :updated_at, :user, :original_name, :desired_name) q.apply_default_order(params) end diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 603ddcecd..f92a0936e 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -65,9 +65,7 @@ class WikiPage < ApplicationRecord end def search(params = {}) - q = super - - q = q.search_attributes(params, :is_locked, :is_deleted, :body, :title, :other_names) + q = search_attributes(params, :id, :created_at, :updated_at, :is_locked, :is_deleted, :body, :title, :other_names) q = q.text_attribute_matches(:body, params[:body_matches], index_column: :body_index, ts_config: "danbooru") if params[:title_normalize].present? diff --git a/app/models/wiki_page_version.rb b/app/models/wiki_page_version.rb index b0687b191..264474951 100644 --- a/app/models/wiki_page_version.rb +++ b/app/models/wiki_page_version.rb @@ -7,9 +7,7 @@ class WikiPageVersion < ApplicationRecord module SearchMethods def search(params) - q = super - - q = q.search_attributes(params, :title, :body, :other_names, :is_locked, :is_deleted) + q = search_attributes(params, :id, :created_at, :updated_at, :title, :body, :other_names, :is_locked, :is_deleted) q = q.text_attribute_matches(:title, params[:title_matches]) q = q.text_attribute_matches(:body, params[:body_matches])