summaryrefslogtreecommitdiffstats
path: root/api4
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2018-06-19 05:46:29 -0400
committerCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-06-19 11:46:29 +0200
commit226d4b2ac8888646271b9e9e83a513cd6e62d620 (patch)
treeb79a3eff5768f4b9f589b78a7e18324a53cf8e5b /api4
parent6d8140337ef0f68f5177988f3c87bba5e4946399 (diff)
downloadchat-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 'api4')
-rw-r--r--api4/post.go6
1 files changed, 4 insertions, 2 deletions
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) {