summaryrefslogtreecommitdiffstats
path: root/model/client4.go
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 /model/client4.go
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 'model/client4.go')
-rw-r--r--model/client4.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index f5a856835..3a93a9541 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -2127,6 +2127,17 @@ func (c *Client4) SearchPosts(teamId string, terms string, isOrSearch bool) (*Po
}
}
+// SearchPosts returns any posts with matching terms string, including .
+func (c *Client4) SearchPostsWithMatches(teamId string, terms string, isOrSearch bool) (*PostSearchResults, *Response) {
+ requestBody := map[string]interface{}{"terms": terms, "is_or_search": isOrSearch}
+ if r, err := c.DoApiPost(c.GetTeamRoute(teamId)+"/posts/search", StringInterfaceToJson(requestBody)); err != nil {
+ return nil, BuildErrorResponse(r, err)
+ } else {
+ defer closeBody(r)
+ return PostSearchResultsFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// DoPostAction performs a post action.
func (c *Client4) DoPostAction(postId, actionId string) (bool, *Response) {
if r, err := c.DoApiPost(c.GetPostRoute(postId)+"/actions/"+actionId, ""); err != nil {