search: add comment:<text>, note:<text> metatags.
This commit is contained in:
@@ -34,6 +34,8 @@ class PostQueryBuilder
|
||||
-ordfav ordfav
|
||||
-favgroup favgroup ordfavgroup
|
||||
-pool pool ordpool
|
||||
-note note
|
||||
-comment comment
|
||||
-commentary commentary
|
||||
-id id
|
||||
-rating rating
|
||||
@@ -195,6 +197,14 @@ class PostQueryBuilder
|
||||
commentary_matches(value, quoted)
|
||||
when "-commentary"
|
||||
commentary_matches(value, quoted).negate
|
||||
when "note"
|
||||
note_matches(value)
|
||||
when "-note"
|
||||
note_matches(value).negate
|
||||
when "comment"
|
||||
comment_matches(value)
|
||||
when "-comment"
|
||||
comment_matches(value).negate
|
||||
when "search"
|
||||
saved_search_matches(value)
|
||||
when "-search"
|
||||
@@ -470,6 +480,14 @@ class PostQueryBuilder
|
||||
favorites_include(username).joins(:favorites).merge(Favorite.for_user(user.id)).order("favorites.id DESC")
|
||||
end
|
||||
|
||||
def note_matches(query)
|
||||
Post.where(notes: Note.search(body_matches: query).reorder(nil))
|
||||
end
|
||||
|
||||
def comment_matches(query)
|
||||
Post.where(comments: Comment.search(body_matches: query).reorder(nil))
|
||||
end
|
||||
|
||||
def commentary_matches(query, quoted = false)
|
||||
case query.downcase
|
||||
in "none" | "false" unless quoted
|
||||
|
||||
Reference in New Issue
Block a user