From 647c0cccdc7612aa8242257fe19d4f13bd30e82e Mon Sep 17 00:00:00 2001 From: Donovan Daniels Date: Fri, 17 Jan 2025 19:21:44 -0600 Subject: [PATCH] Fix aliased query handling for e621 pool search --- app/logical/e621_pool_query_builder.rb | 2 +- app/models/e621/tag_alias.rb | 4 ++++ app/models/e621/tag_implication.rb | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/logical/e621_pool_query_builder.rb b/app/logical/e621_pool_query_builder.rb index 388a955..06fa2a0 100644 --- a/app/logical/e621_pool_query_builder.rb +++ b/app/logical/e621_pool_query_builder.rb @@ -13,7 +13,7 @@ class E621PoolQueryBuilder def add_tag_string_search(query) tag_list = query.split - aliases = E621::TagAlias.where(antecedent_name: tag_list.map { |t| t.sub(/\A([-~])/, "") }) + aliases = E621::TagAlias.active.where(antecedent_name: tag_list.map { |t| t.sub(/\A([-~])/, "") }) tag_list.map do |tag| type = :must if tag =~ /\A([-~])/ diff --git a/app/models/e621/tag_alias.rb b/app/models/e621/tag_alias.rb index 1b5ec2c..7fe97ce 100644 --- a/app/models/e621/tag_alias.rb +++ b/app/models/e621/tag_alias.rb @@ -4,6 +4,10 @@ module E621 class TagAlias < ApplicationRecord self.table_name = "e621.tag_aliases" + scope :active, -> { where(status: "active") } + scope :deleted, -> { where(status: "deleted") } + scope :pending, -> { where(status: "pending") } + module SyncMethods def sync E621ExportDownloadJob.perform("tag_aliases") diff --git a/app/models/e621/tag_implication.rb b/app/models/e621/tag_implication.rb index 0931e87..bc1c9fe 100644 --- a/app/models/e621/tag_implication.rb +++ b/app/models/e621/tag_implication.rb @@ -4,6 +4,10 @@ module E621 class TagImplication < ApplicationRecord self.table_name = "e621.tag_implications" + scope :active, -> { where(status: "active") } + scope :deleted, -> { where(status: "deleted") } + scope :pending, -> { where(status: "pending") } + module SyncMethods def sync E621ExportDownloadJob.perform_later("tag_implications")