mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-24530-Add support for search terms with underscore using postgresql engine (#16618)
* add support for search terms with underscore using postgresql * fix failing tests Initially issue fix applied to all search terms instead of the ones that contains _ * direct cast tsquery * fix test issues * refactor underscored quoted term search * support search term case-insensitive Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -2249,6 +2249,27 @@ func TestSearchHashtagPosts(t *testing.T) {
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
}
|
||||
|
||||
func TestSearchUnderscorePosts(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.LoginBasic()
|
||||
Client := th.Client
|
||||
|
||||
message := "test_with_underscore"
|
||||
assert.NotNil(t, th.CreateMessagePost(message))
|
||||
|
||||
message = " test with underscore"
|
||||
assert.NotNil(t, th.CreateMessagePost(message))
|
||||
|
||||
posts, resp := Client.SearchPosts(th.BasicTeam.Id, "test_with_underscore", false)
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, posts.Order, 1, "wrong search results")
|
||||
|
||||
Client.Logout()
|
||||
_, resp = Client.SearchPosts(th.BasicTeam.Id, "#sgtitlereview", false)
|
||||
CheckUnauthorizedStatus(t, resp)
|
||||
}
|
||||
|
||||
func TestSearchPostsInChannel(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Reference in New Issue
Block a user