mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: username search logic was stemming and not ordering right
This commit is contained in:
parent
5bcfb6ee38
commit
cf60bed719
3 changed files with 20 additions and 12 deletions
|
@ -242,10 +242,11 @@ class Search
|
|||
self.class.query_locale
|
||||
end
|
||||
|
||||
def self.ts_query(term)
|
||||
def self.ts_query(term, locale = nil)
|
||||
locale = Post.sanitize(locale) if locale
|
||||
all_terms = term.gsub(/[:()&!'"]/,'').split
|
||||
query = Post.sanitize(all_terms.map {|t| "#{PG::Connection.escape_string(t)}:*"}.join(" & "))
|
||||
"TO_TSQUERY(#{query_locale}, #{query})"
|
||||
"TO_TSQUERY(#{locale || query_locale}, #{query})"
|
||||
end
|
||||
|
||||
def ts_query
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue