summaryrefslogtreecommitdiffstats
path: root/store/sqlstore/user_store.go
diff options
context:
space:
mode:
Diffstat (limited to 'store/sqlstore/user_store.go')
-rw-r--r--store/sqlstore/user_store.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/store/sqlstore/user_store.go b/store/sqlstore/user_store.go
index 5ecc1fdda..549377d61 100644
--- a/store/sqlstore/user_store.go
+++ b/store/sqlstore/user_store.go
@@ -1022,15 +1022,30 @@ func (us SqlUserStore) SearchInChannel(channelId string, term string, options ma
})
}
-var escapeUserSearchChar = []string{
+var escapeLikeSearchChar = []string{
"%",
"_",
}
-var ignoreUserSearchChar = []string{
+var ignoreLikeSearchChar = []string{
"*",
}
+var spaceFulltextSearchChar = []string{
+ "<",
+ ">",
+ "+",
+ "-",
+ "(",
+ ")",
+ "~",
+ ":",
+ "*",
+ "\"",
+ "!",
+ "@",
+}
+
func generateSearchQuery(searchQuery string, terms []string, fields []string, parameters map[string]interface{}, isPostgreSQL bool) string {
searchTerms := []string{}
for i, term := range terms {
@@ -1054,12 +1069,12 @@ func (us SqlUserStore) performSearch(searchQuery string, term string, options ma
result := store.StoreResult{}
// These chars must be removed from the like query.
- for _, c := range ignoreUserSearchChar {
+ for _, c := range ignoreLikeSearchChar {
term = strings.Replace(term, c, "", -1)
}
// These chars must be escaped in the like query.
- for _, c := range escapeUserSearchChar {
+ for _, c := range escapeLikeSearchChar {
term = strings.Replace(term, c, "*"+c, -1)
}