diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2018-06-19 05:46:29 -0400 |
---|---|---|
committer | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2018-06-19 11:46:29 +0200 |
commit | 226d4b2ac8888646271b9e9e83a513cd6e62d620 (patch) | |
tree | b79a3eff5768f4b9f589b78a7e18324a53cf8e5b /app | |
parent | 6d8140337ef0f68f5177988f3c87bba5e4946399 (diff) | |
download | chat-226d4b2ac8888646271b9e9e83a513cd6e62d620.tar.gz chat-226d4b2ac8888646271b9e9e83a513cd6e62d620.tar.bz2 chat-226d4b2ac8888646271b9e9e83a513cd6e62d620.zip |
MM-6992 Added highlighting to elasticsearch results (#8861)
* MM-6992 Added highlighting to elasticsearch results
* Added a unique type for post search matches
* Fixed Elasticsearch matches not being sent through API
Diffstat (limited to 'app')
-rw-r--r-- | app/post.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/post.go b/app/post.go index 4f4c6f65c..e24018995 100644 --- a/app/post.go +++ b/app/post.go @@ -621,7 +621,7 @@ func (a *App) DeletePostFiles(post *model.Post) { } } -func (a *App) SearchPostsInTeam(terms string, userId string, teamId string, isOrSearch bool) (*model.PostList, *model.AppError) { +func (a *App) SearchPostsInTeam(terms string, userId string, teamId string, isOrSearch bool) (*model.PostSearchResults, *model.AppError) { paramsList := model.ParseSearchParams(terms) esInterface := a.Elasticsearch @@ -656,7 +656,7 @@ func (a *App) SearchPostsInTeam(terms string, userId string, teamId string, isOr // If the processed search params are empty, return empty search results. if len(finalParamsList) == 0 { - return model.NewPostList(), nil + return model.MakePostSearchResults(model.NewPostList(), nil), nil } // We only allow the user to search in channels they are a member of. @@ -666,7 +666,7 @@ func (a *App) SearchPostsInTeam(terms string, userId string, teamId string, isOr return nil, err } - postIds, err := a.Elasticsearch.SearchPosts(userChannels, finalParamsList) + postIds, matches, err := a.Elasticsearch.SearchPosts(userChannels, finalParamsList) if err != nil { return nil, err } @@ -684,7 +684,7 @@ func (a *App) SearchPostsInTeam(terms string, userId string, teamId string, isOr } } - return postList, nil + return model.MakePostSearchResults(postList, matches), nil } else { if !*a.Config().ServiceSettings.EnablePostSearch { return nil, model.NewAppError("SearchPostsInTeam", "store.sql_post.search.disabled", nil, fmt.Sprintf("teamId=%v userId=%v", teamId, userId), http.StatusNotImplemented) @@ -712,7 +712,7 @@ func (a *App) SearchPostsInTeam(terms string, userId string, teamId string, isOr posts.SortByCreateAt() - return posts, nil + return model.MakePostSearchResults(posts, nil), nil } } |