Fix aliased query handling for e621 pool search

This commit is contained in:
Donovan Daniels 2025-01-17 19:21:44 -06:00
parent 13dfa5ce2b
commit 647c0cccdc
No known key found for this signature in database
GPG Key ID: 743DAAE6359EDBA1
3 changed files with 9 additions and 1 deletions

View File

@ -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([-~])/

View File

@ -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")

View File

@ -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")