Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

FIx search with hyphenated words.

Matt Roberts75a423a6a6d6
diff --git a/app/services/sqlstore/postgres/common.go b/app/services/sqlstore/postgres/common.go
index 1c6a8af2f..49f94fb8c 100644
--- a/app/services/sqlstore/postgres/common.go
+++ b/app/services/sqlstore/postgres/common.go
@@ -18,7 +18,7 @@ var replaceOr = strings.NewReplacer("|", " ")
// ToTSQuery converts input to another string that can be safely used for ts_query
func ToTSQuery(input string) string {
- input = replaceOr.Replace(allowedTextRunes.ReplaceAllString(input, ""))
+ input = replaceOr.Replace(allowedTextRunes.ReplaceAllString(input, " "))
return strings.Join(strings.Fields(input), "|")
}
diff --git a/app/services/sqlstore/postgres/common_test.go b/app/services/sqlstore/postgres/common_test.go
index 15ffee531..fcd86dd87 100644
--- a/app/services/sqlstore/postgres/common_test.go
+++ b/app/services/sqlstore/postgres/common_test.go
@@ -28,6 +28,8 @@ func TestToTSQuery(t *testing.T) {
{"hello|world", "hello|world"},
{"hello | world", "hello|world"},
{"hello & world", "hello|world"},
+ {"node-js", "node|js"},
+ {"real-time updates", "real|time|updates"},
}
for _, testcase := range testcases {