Added pixiv: metatag and Pixiv source indexes

Adds a pixiv: metatag to quickly find posts by Pixiv ID.  Adds
source:pixiv/* searches to allow left-anchored source searches for Pixiv
sources.  Added relevant indexes to make these queries efficient.
This commit is contained in:
Coconut
2013-03-06 12:19:20 -05:00
parent 31927b54d7
commit 3fd375b23a
3 changed files with 33 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
class Tag < ActiveRecord::Base
METATAGS = "-user|user|-approver|approver|-pool|pool|-fav|fav|sub|md5|-rating|rating|width|height|mpixels|score|filesize|source|id|date|order|status|tagcount|gentags|arttags|chartags|copytags|parent"
METATAGS = "-user|user|-approver|approver|-pool|pool|-fav|fav|sub|md5|-rating|rating|width|height|mpixels|score|filesize|source|id|date|order|status|tagcount|gentags|arttags|chartags|copytags|parent|pixiv"
attr_accessible :category
after_save :update_category_cache_for_all
has_one :wiki_page, :foreign_key => "name", :primary_key => "title"
@@ -308,8 +308,8 @@ class Tag < ActiveRecord::Base
q[:filesize] = parse_helper($2, :filesize)
when "source"
q[:source] = $2.to_escaped_for_sql_like + "%"
q[:source] = ($2.to_escaped_for_sql_like + "%").gsub(/%+/, '%')
when "date"
q[:date] = parse_helper($2, :date)
@@ -337,6 +337,9 @@ class Tag < ActiveRecord::Base
when "status"
q[:status] = $2
when "pixiv"
q[:pixiv] = parse_helper($2)
end
else