summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2017-04-17 07:54:26 -0700
committerChristopher Speller <crspeller@gmail.com>2017-04-17 10:54:26 -0400
commit32078865147dc4779023e036aba164842067e58b (patch)
treed94cf763a265630ea0e963a0d847d6391627ed24 /model
parent7e29dc65aaf5b310f1c1e3b8e8849103892e1ffe (diff)
downloadchat-32078865147dc4779023e036aba164842067e58b.tar.gz
chat-32078865147dc4779023e036aba164842067e58b.tar.bz2
chat-32078865147dc4779023e036aba164842067e58b.zip
Adding the ability to disable full text search queries for master (#6102)
Diffstat (limited to 'model')
-rw-r--r--model/config.go6
-rw-r--r--model/search_params.go10
2 files changed, 16 insertions, 0 deletions
diff --git a/model/config.go b/model/config.go
index 90302bfec..206f5d70e 100644
--- a/model/config.go
+++ b/model/config.go
@@ -151,6 +151,7 @@ type ServiceSettings struct {
AllowEditPost *string
PostEditTimeLimit *int
TimeBetweenUserTypingUpdatesMilliseconds *int64
+ EnablePostSearch *bool
EnableUserTypingMessages *bool
ClusterLogTimeoutMilliseconds *int
}
@@ -1148,6 +1149,11 @@ func (o *Config) SetDefaults() {
*o.ServiceSettings.TimeBetweenUserTypingUpdatesMilliseconds = 5000
}
+ if o.ServiceSettings.EnablePostSearch == nil {
+ o.ServiceSettings.EnablePostSearch = new(bool)
+ *o.ServiceSettings.EnablePostSearch = true
+ }
+
if o.ServiceSettings.EnableUserTypingMessages == nil {
o.ServiceSettings.EnableUserTypingMessages = new(bool)
*o.ServiceSettings.EnableUserTypingMessages = true
diff --git a/model/search_params.go b/model/search_params.go
index 802ec1be8..070ac6d24 100644
--- a/model/search_params.go
+++ b/model/search_params.go
@@ -4,6 +4,7 @@
package model
import (
+ "encoding/json"
"regexp"
"strings"
)
@@ -19,6 +20,15 @@ type SearchParams struct {
OrTerms bool
}
+func (o *SearchParams) ToJson() string {
+ b, err := json.Marshal(o)
+ if err != nil {
+ return ""
+ } else {
+ return string(b)
+ }
+}
+
var searchFlags = [...]string{"from", "channel", "in"}
func splitWordsNoQuotes(text string) []string {