* Removed memcaching for TagImplication (too many latent race conditions)

* Added Post.exact_tag_match to skip normalization/metatag parsing
* Added DelayedJob support for tag alias/implication processing
This commit is contained in:
albert
2011-08-04 19:54:13 -04:00
parent 09d7bba90a
commit e106f70b6d
18 changed files with 123 additions and 162 deletions

View File

@@ -41,6 +41,7 @@ class Post < ActiveRecord::Base
scope :available_for_moderation, lambda {where(["id NOT IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id])}
scope :hidden_from_moderation, lambda {where(["id IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id])}
scope :tag_match, lambda {|query| Post.tag_match_helper(query)}
scope :exact_tag_match, lambda {|query| Post.exact_tag_match_helper(query)}
scope :positive, where("score > 1")
scope :negative, where("score < -1")
search_methods :tag_match
@@ -501,6 +502,11 @@ class Post < ActiveRecord::Base
relation
end
def exact_tag_match_helper(q)
arel = Post.scoped
add_tag_string_search_relation({:related => [q].flatten, :include => [], :exclude => []}, arel)
end
def tag_match_helper(q)
unless q.is_a?(Hash)