Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding paging to elasticsearch API #9425

Merged
merged 1 commit into from Sep 26, 2018
Merged

Adding paging to elasticsearch API #9425

merged 1 commit into from Sep 26, 2018

Conversation

crspeller
Copy link
Member

Summary

  • Adds paging to Elasticsearch API
  • Note that paging is not supported with DB search.
  • Modifies the location of include_deleted_channels parameter to the POST body rather than the query string
  • Client support PR in progress.

API PR: mattermost/mattermost-api-reference#392
Enterprise PR: https://github.com/mattermost/enterprise/pull/357

@crspeller crspeller added the 2: Dev Review Requires review by a developer label Sep 17, 2018
@crspeller crspeller added the Work In Progress Not yet ready for review label Sep 17, 2018
@crspeller crspeller removed the Work In Progress Not yet ready for review label Sep 17, 2018
@@ -330,26 +330,42 @@ func searchPosts(c *Context, w http.ResponseWriter, r *http.Request) {
return
}

includeDeletedChannels := r.URL.Query().Get("include_deleted_channels") == "true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't be backwards compatibly since we're changing how this parameter is specified. We should try falling back to the query parameter if it's not specified in the body

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But this feature was never released. (it's experimental)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crspeller Are we removing a feature from the ExperimentalViewArchivedChannels setting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

c.SetInvalidParam("terms")
return
}
terms := *params.Terms

timeZoneOffset := 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This process for parsing the search parameters is a bit complicated for me right now since it turns the body of the request into a model.SearchParameter, sets defaults, passes the fields into App.SearchPostsInTeam, and then recombines them back into an array of model.SearchParams. I don't know if it's something to change now since it'd take some extra time to refactor and work out, but it could definitely be made simpler

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya it's a bit strange, but I only wanted to fix what was needed.

@@ -2168,17 +2168,6 @@ func (c *Client4) SearchPostsWithParams(teamId string, params *SearchParameter)
}
}

// SearchPosts returns any posts with matching terms string including deleted channels.
func (c *Client4) SearchPostsIncludeDeletedChannels(teamId string, terms string, isOrSearch bool) (*PostList, *Response) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can remove this since we want backwards compatibility here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's for an experimental feature. So we can remove it.

@jasonblais
Copy link
Contributor

@hmhealey Ready for re-review

@hmhealey hmhealey added Awaiting Submitter Action Blocked on the author and removed 2: Dev Review Requires review by a developer labels Sep 25, 2018
@hmhealey
Copy link
Member

hmhealey commented Sep 25, 2018

@crspeller The build for this one is failing, but it otherwise looks good

@jasonblais jasonblais added 4: Reviews Complete All reviewers have approved the pull request and removed Awaiting Submitter Action Blocked on the author labels Sep 26, 2018
@jasonblais
Copy link
Contributor

@hmhealey @crspeller or @grundleborg please help merge this and the enterprise PR https://github.com/mattermost/enterprise/pull/357

We'll start PM/QA review of the webapp PR after that for Thursday's cut-off date.

@hmhealey hmhealey merged commit 37e00ef into master Sep 26, 2018
@hmhealey hmhealey deleted the mm-8683 branch September 26, 2018 14:27
@amyblais amyblais added Docs/Needed Requires documentation Changelog/Done Required changelog entry has been written and removed Changelog/Done Required changelog entry has been written Docs/Needed Requires documentation labels Sep 27, 2018
gupsho pushed a commit to gupsho/mattermost-server that referenced this pull request Oct 1, 2018
@lindalumitchell lindalumitchell added the Tests/Not Needed New release tests not required label Oct 3, 2018
@amyblais amyblais added Docs/Done Required documentation has been written Changelog/Done Required changelog entry has been written labels Nov 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Done Required changelog entry has been written Docs/Done Required documentation has been written Tests/Not Needed New release tests not required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants