Add the API for search files (#15605)
* Adding search files api * Fixing golangci-lint * Adding bulk-indexing and improving a bit the name indexing for bleve and elasticsearch * Add content extraction config migration * Fixing a problem with document extraction * Unapplying certain changes moved to other PR * Fixing tests * Making extract content app migration a private method * Addressing PR review comments * Addressing PR review comments * Adding feature flag * Removing debug string * Fixing imports * Fixing linting errors * Do not migrate the config if the feature flag is not enabled * Fix tests Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
074a8e5fd9
Коммит
85293fcf41
@@ -3044,6 +3044,25 @@ func (c *Client4) GetPostsAroundLastUnread(userId, channelId string, limitBefore
|
||||
return PostListFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// SearchFiles returns any posts with matching terms string.
|
||||
func (c *Client4) SearchFiles(teamId string, terms string, isOrSearch bool) (*FileInfoList, *Response) {
|
||||
params := SearchParameter{
|
||||
Terms: &terms,
|
||||
IsOrSearch: &isOrSearch,
|
||||
}
|
||||
return c.SearchFilesWithParams(teamId, ¶ms)
|
||||
}
|
||||
|
||||
// SearchFilesWithParams returns any posts with matching terms string.
|
||||
func (c *Client4) SearchFilesWithParams(teamId string, params *SearchParameter) (*FileInfoList, *Response) {
|
||||
r, err := c.DoApiPost(c.GetTeamRoute(teamId)+"/files/search", params.SearchParameterToJson())
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
}
|
||||
defer closeBody(r)
|
||||
return FileInfoListFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// SearchPosts returns any posts with matching terms string.
|
||||
func (c *Client4) SearchPosts(teamId string, terms string, isOrSearch bool) (*PostList, *Response) {
|
||||
params := SearchParameter{
|
||||
|
||||
@@ -335,6 +335,7 @@ type ServiceSettings struct {
|
||||
PostEditTimeLimit *int `access:"user_management_permissions"`
|
||||
TimeBetweenUserTypingUpdatesMilliseconds *int64 `access:"experimental,write_restrictable,cloud_restrictable"`
|
||||
EnablePostSearch *bool `access:"write_restrictable,cloud_restrictable"`
|
||||
EnableFileSearch *bool `access:"write_restrictable"`
|
||||
MinimumHashtagLength *int `access:"environment,write_restrictable,cloud_restrictable"`
|
||||
EnableUserTypingMessages *bool `access:"experimental,write_restrictable,cloud_restrictable"`
|
||||
EnableChannelViewedMessages *bool `access:"experimental,write_restrictable,cloud_restrictable"`
|
||||
@@ -537,6 +538,10 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
|
||||
s.EnablePostSearch = NewBool(true)
|
||||
}
|
||||
|
||||
if s.EnableFileSearch == nil {
|
||||
s.EnableFileSearch = NewBool(true)
|
||||
}
|
||||
|
||||
if s.MinimumHashtagLength == nil {
|
||||
s.MinimumHashtagLength = NewInt(3)
|
||||
}
|
||||
@@ -1353,6 +1358,8 @@ type FileSettings struct {
|
||||
DriverName *string `access:"environment,write_restrictable,cloud_restrictable"`
|
||||
Directory *string `access:"environment,write_restrictable,cloud_restrictable"`
|
||||
EnablePublicLink *bool `access:"site,cloud_restrictable"`
|
||||
ExtractContent *bool `access:"environment,write_restrictable"`
|
||||
ArchiveRecursion *bool `access:"environment,write_restrictable"`
|
||||
PublicLinkSalt *string `access:"site,cloud_restrictable"` // telemetry: none
|
||||
InitialFont *string `access:"environment,cloud_restrictable"` // telemetry: none
|
||||
AmazonS3AccessKeyId *string `access:"environment,write_restrictable,cloud_restrictable"` // telemetry: none
|
||||
@@ -1396,6 +1403,14 @@ func (s *FileSettings) SetDefaults(isUpdate bool) {
|
||||
s.EnablePublicLink = NewBool(false)
|
||||
}
|
||||
|
||||
if s.ExtractContent == nil {
|
||||
s.ExtractContent = NewBool(false)
|
||||
}
|
||||
|
||||
if s.ArchiveRecursion == nil {
|
||||
s.ArchiveRecursion = NewBool(false)
|
||||
}
|
||||
|
||||
if isUpdate {
|
||||
// When updating an existing configuration, ensure link salt has been specified.
|
||||
if s.PublicLinkSalt == nil || *s.PublicLinkSalt == "" {
|
||||
|
||||
Ссылка в новой задаче
Block a user