         text-query (->> parsed
                         (insta/transform
                           {:DOT str
-                           :TAG (constantly "")})
+                           :TAG (constantly "")
+                           :USER (constantly "")})
                         rest
                         (string/join "")
                         squash)
         tag-query (->> parsed
                        (insta/transform
                          {:DOT (constantly nil)
-                          :TAG identity})
+                          :TAG identity
+                          :USER (constantly nil)})
+                       rest
+                       (remove nil?))
+        user-query (->> parsed
+                       (insta/transform
+                         {:DOT (constantly nil)
+                          :TAG (constantly nil)
+                          :USER identity})
                        rest
                        (remove nil?))]
     {:text text-query
-     :tags tag-query}))
+     :tags tag-query
+     :users user-query}))
 
 (defn search-threads-as
   "Return the ids of all threads, visible to the user, in the given group,

; TODO: some way to search for a tag with spaces in it?
(def query-parser
  (insta/parser
    "S ::= ( TAG / DOT ) *
    DOT ::= #'(?s).'
    <ws> ::= #'\\s*'
    TAG ::= <'#'> #'[^ ]+'
    "))

(defn squash

                               search-db
                               tags
                               group-id)))
        user-search (when (seq users)
                      (set (d/q '[:find ?t-id (max ?time)
                                  :in $ [?user-name ...] ?g-id
                                  :where
                                  [?g :group/id ?g-id]
                                  [?user :user/nickname ?user-name]
                                  [?g :group/user ?user]
                                  [?t :thread/id ?t-id]
                                  [?t :thread/mentioned ?user]
                                  [?m :message/thread ?t]
                                  [?m :message/created-at ?time]]
                                search-db
                                users
                                group-id)))
        text-search (when-not (string/blank? text)
                      (if (elastic/elasticsearch-enabled?)
                        (elastic/search-for {:text text
