summaryrefslogtreecommitdiffstats
path: root/store/sql_post_store.go
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-08-13 15:52:52 -0700
committernickago <ngonella@calpoly.edu>2015-08-27 08:57:07 -0700
commit824917b029826384129e504e83739fcc55541b4f (patch)
tree007a18731eaa45fe3f32c462b2494f7b810dbb46 /store/sql_post_store.go
parent72fc15ddf370acd836736ff3e3cd33c24c126a17 (diff)
downloadchat-824917b029826384129e504e83739fcc55541b4f.tar.gz
chat-824917b029826384129e504e83739fcc55541b4f.tar.bz2
chat-824917b029826384129e504e83739fcc55541b4f.zip
Added wildcard highlighting and removed redundant whitespace parsing
Diffstat (limited to 'store/sql_post_store.go')
-rw-r--r--store/sql_post_store.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index fdff27b82..e30691154 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -419,15 +419,15 @@ func (s SqlPostStore) Search(teamId string, userId string, terms string, isHasht
// cannot escape it so we replace it.
terms = strings.Replace(terms, "@", " ", -1)
- // Parse text for wildcards
- if wildcard, err := regexp.Compile("\\*($| )"); err == nil {
- terms = wildcard.ReplaceAllLiteralString(terms, ":* ")
- terms = strings.Replace(terms, " ", " ", -1)
- }
-
var posts []*model.Post
if utils.Cfg.SqlSettings.DriverName == "postgres" {
+
+ // Parse text for wildcards
+ if wildcard, err := regexp.Compile("\\*($| )"); err == nil {
+ terms = wildcard.ReplaceAllLiteralString(terms, ":* ")
+ }
+
searchQuery := fmt.Sprintf(`SELECT
*
FROM