summaryrefslogtreecommitdiffstats
path: root/store/sql_user_store.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-11-03 11:24:45 -0400
committerCorey Hulen <corey@hulen.com>2016-11-03 08:24:45 -0700
commit6da0ccd94447ddc5bcf51285ebac411dd3188cce (patch)
tree9334fa81ebbd23463134c6e5673e089ebf222836 /store/sql_user_store.go
parent1b141681ae6a169272003fa83fb83ba245dbafc7 (diff)
downloadchat-6da0ccd94447ddc5bcf51285ebac411dd3188cce.tar.gz
chat-6da0ccd94447ddc5bcf51285ebac411dd3188cce.tar.bz2
chat-6da0ccd94447ddc5bcf51285ebac411dd3188cce.zip
Update user search to match against username, full name, nickname and email (#4421)
Diffstat (limited to 'store/sql_user_store.go')
-rw-r--r--store/sql_user_store.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go
index 17fdcbc85..836a502fc 100644
--- a/store/sql_user_store.go
+++ b/store/sql_user_store.go
@@ -19,10 +19,10 @@ const (
MISSING_AUTH_ACCOUNT_ERROR = "store.sql_user.get_by_auth.missing_account.app_error"
PROFILES_IN_CHANNEL_CACHE_SIZE = 5000
PROFILES_IN_CHANNEL_CACHE_SEC = 900 // 15 mins
- USER_SEARCH_OPTION_USERNAME_ONLY = "username_only"
+ USER_SEARCH_OPTION_NAMES_ONLY = "names_only"
USER_SEARCH_OPTION_ALLOW_INACTIVE = "allow_inactive"
- USER_SEARCH_TYPE_ALL = "Username, FirstName, LastName, Nickname"
- USER_SEARCH_TYPE_USERNAME = "Username"
+ USER_SEARCH_TYPE_NAMES = "Username, FirstName, LastName, Nickname"
+ USER_SEARCH_TYPE_ALL = "Username, FirstName, LastName, Nickname, Email"
)
type SqlUserStore struct {
@@ -61,8 +61,8 @@ func (us SqlUserStore) CreateIndexesIfNotExists() {
us.CreateIndexIfNotExists("idx_users_create_at", "Users", "CreateAt")
us.CreateIndexIfNotExists("idx_users_delete_at", "Users", "DeleteAt")
- us.CreateFullTextIndexIfNotExists("idx_users_username_txt", "Users", USER_SEARCH_TYPE_USERNAME)
- us.CreateFullTextIndexIfNotExists("idx_users_all_names_txt", "Users", USER_SEARCH_TYPE_ALL)
+ us.CreateFullTextIndexIfNotExists("idx_users_all_txt", "Users", USER_SEARCH_TYPE_ALL)
+ us.CreateFullTextIndexIfNotExists("idx_users_names_txt", "Users", USER_SEARCH_TYPE_NAMES)
}
func (us SqlUserStore) Save(user *model.User) StoreChannel {
@@ -1212,8 +1212,8 @@ func (us SqlUserStore) performSearch(searchQuery string, term string, options ma
}
searchType := USER_SEARCH_TYPE_ALL
- if ok := options[USER_SEARCH_OPTION_USERNAME_ONLY]; ok {
- searchType = USER_SEARCH_TYPE_USERNAME
+ if ok := options[USER_SEARCH_OPTION_NAMES_ONLY]; ok {
+ searchType = USER_SEARCH_TYPE_NAMES
}
if ok := options[USER_SEARCH_OPTION_ALLOW_INACTIVE]; ok {