search: fix invalid username searches returning wrong results.
Partial fix for #4389. * Fix invalid username searches returning all posts instead of no posts. * Fix "user:A user:B" returning results for user:B instead of no results. * Fix "approver:A approver:B" returning results for approver:B instead of no results. * Add support for negated -commenter, -noter, -noteupdater, -upvote, -downvote metatags. * Add support for "any" and "none" values for all username metatags, including negated metatags that didn't support "any" or "none" before. * Change noter:any and commenter:any to include posts with deleted notes or comments. Note that commenter:<username> already included deleted comments before. This is so that commenter:any has the same behavior as commenter:<username>
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
module Searchable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
def negate(kind = :nor)
|
||||
unscoped.where(all.where_clause.invert(kind).ast)
|
||||
end
|
||||
|
||||
def where_like(attr, value)
|
||||
where("#{qualified_column_for(attr)} LIKE ? ESCAPE E'\\\\'", value.to_escaped_for_sql_like)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user