partially fixed postgres search so that multiple search terms work

This commit is contained in:
JoramWilander
2015-07-30 09:55:03 -04:00
parent b2b6bddadc
commit bcee238666
2 changed files with 6 additions and 1 deletions

View File

@@ -401,7 +401,7 @@ func (s SqlPostStore) Search(teamId string, userId string, terms string, isHasht
Id = ChannelId AND TeamId = $1
AND UserId = $2
AND DeleteAt = 0)
AND %s @@ plainto_tsquery($3)
AND %s @@ to_tsquery($3)
ORDER BY CreateAt DESC
LIMIT 100`, searchType)

View File

@@ -483,4 +483,9 @@ func TestPostStoreSearch(t *testing.T) {
if len(r8.Order) != 0 {
t.Fatal("returned wrong serach result")
}
r9 := (<-store.Post().Search(teamId, userId, "mattermost jersey", false)).Data.(*model.PostList)
if len(r9.Order) != 2 {
t.Fatal("returned wrong search result")
}
}