fixes #162: Excluded tag searches (i.e. -tag) don't work alone or with metatags.

This commit is contained in:
albert
2011-10-26 18:40:25 -04:00
parent 9f21630c33
commit aa1443da6e

View File

@@ -559,11 +559,7 @@ class Post < ActiveRecord::Base
if tags[:exclude].any?
raise SearchError.new("You cannot search for more than #{Danbooru.config.tag_query_limit} tags at a time") if tags[:exclude].size > Danbooru.config.tag_query_limit
if tags[:related].any? || tags[:include].any?
tag_query_sql << "!(" + escape_string_for_tsquery(tags[:exclude]).join(" | ") + ")"
else
raise SearchError.new("You cannot search for only excluded tags")
end
tag_query_sql << "!(" + escape_string_for_tsquery(tags[:exclude]).join(" | ") + ")"
end
if tag_query_sql.any?