summaryrefslogtreecommitdiffstats
path: root/model/search_params.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-01-27 07:38:10 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-01-27 07:38:10 -0500
commite5ed90821e6bb25c27e5627cf289df41cbcb1793 (patch)
tree98446b1586e29afbedb92f9a63446d12a72f8b83 /model/search_params.go
parentefc4d239e14707de27b149b76f1dd4065838410c (diff)
parent97ede2a428faf3a62ce0140e51ed591e261c09a1 (diff)
downloadchat-e5ed90821e6bb25c27e5627cf289df41cbcb1793.tar.gz
chat-e5ed90821e6bb25c27e5627cf289df41cbcb1793.tar.bz2
chat-e5ed90821e6bb25c27e5627cf289df41cbcb1793.zip
Merge pull request #1984 from hmhealey/plt1103
PLT-1103 Updated serverside hashtag regex to ignore more punctuation around words
Diffstat (limited to 'model/search_params.go')
-rw-r--r--model/search_params.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/model/search_params.go b/model/search_params.go
index 17a64d980..9a7406a07 100644
--- a/model/search_params.go
+++ b/model/search_params.go
@@ -20,12 +20,7 @@ func splitWordsNoQuotes(text string) []string {
words := []string{}
for _, word := range strings.Fields(text) {
- word = puncStart.ReplaceAllString(word, "")
- word = puncEnd.ReplaceAllString(word, "")
-
- if len(word) != 0 {
- words = append(words, word)
- }
+ words = append(words, word)
}
return words
@@ -94,7 +89,16 @@ func parseSearchFlags(input []string) ([]string, [][2]string) {
}
if !isFlag {
- words = append(words, word)
+ // trim off surrounding punctuation
+ word = puncStart.ReplaceAllString(word, "")
+ word = puncEnd.ReplaceAllString(word, "")
+
+ // and remove extra pound #s
+ word = hashtagStart.ReplaceAllString(word, "#")
+
+ if len(word) != 0 {
+ words = append(words, word)
+ }
}
}