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

@@ -0,0 +1,15 @@
class AddIndexPixivOnPosts < ActiveRecord::Migration
def up
execute "set statement_timeout = 0"
execute "CREATE INDEX index_posts_on_pixiv_suffix ON posts USING btree
((substring(source, 'pixiv.net/img.*/([^/]*/[^/]*)$')) text_pattern_ops);"
execute "CREATE INDEX index_posts_on_pixiv_id ON posts USING btree
((substring(source, 'pixiv.net/img.*/([0-9]+)[^/]*$')::integer));"
end
def down
execute "set statement_timeout = 0"
execute "DROP INDEX index_posts_on_pixiv_suffix;"
execute "DROP INDEX index_posts_on_pixiv_id;"
end
end