Added wildcard highlighting and removed redundant whitespace parsing

Этот коммит содержится в:
nickago
2015-08-13 15:52:52 -07:00
родитель 72fc15ddf3
Коммит 824917b029
2 изменённых файлов: 21 добавлений и 9 удалений

Просмотреть файл

@@ -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