From 226d4b2ac8888646271b9e9e83a513cd6e62d620 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 19 Jun 2018 05:46:29 -0400 Subject: 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 --- api4/post.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'api4/post.go') diff --git a/api4/post.go b/api4/post.go index 68c1967ff..27ecd1584 100644 --- a/api4/post.go +++ b/api4/post.go @@ -341,7 +341,7 @@ func searchPosts(c *Context, w http.ResponseWriter, r *http.Request) { startTime := time.Now() - posts, err := c.App.SearchPostsInTeam(terms, c.Session.UserId, c.Params.TeamId, isOrSearch) + results, err := c.App.SearchPostsInTeam(terms, c.Session.UserId, c.Params.TeamId, isOrSearch) elapsedTime := float64(time.Since(startTime)) / float64(time.Second) metrics := c.App.Metrics @@ -355,8 +355,10 @@ func searchPosts(c *Context, w http.ResponseWriter, r *http.Request) { return } + results = model.MakePostSearchResults(c.App.PostListWithProxyAddedToImageURLs(results.PostList), results.Matches) + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") - w.Write([]byte(c.App.PostListWithProxyAddedToImageURLs(posts).ToJson())) + w.Write([]byte(results.ToJson())) } func updatePost(c *Context, w http.ResponseWriter, r *http.Request) { -- cgit v1.2.3-1-g7c22