[AI assisted]: MM-62295: Search and index archived channels as well. (#29796)
We add a new field delete_at in the channels template. This field is then searched in the SearchChannels function. Also added tests to verify that archived channels are searched properly, and also indexed correctly. https://mattermost.atlassian.net/browse/MM-62295 ```release-note - Now archived channels are searchable with ES/OS if TeamSettings.ExperimentalViewArchivedChannels is enabled. - If there are old channels which were archived before a bulk index was run, users would need to purge indexes, and do bulk index again. Because those old archived channels are removed from the index when a bulk index is run. ``` Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
57f13549d7
Коммит
afbd9d64c3
@@ -315,7 +315,7 @@ func (b *BleveEngine) IndexChannel(_ request.CTX, channel *model.Channel, userID
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *BleveEngine) SearchChannels(teamId, userID, term string, isGuest bool) ([]string, *model.AppError) {
|
||||
func (b *BleveEngine) SearchChannels(teamId, userID, term string, isGuest, _ bool) ([]string, *model.AppError) {
|
||||
// This query essentially boils down to (if teamID is passed):
|
||||
// match teamID == <>
|
||||
// AND
|
||||
|
||||
@@ -33,7 +33,7 @@ type SearchEngineInterface interface {
|
||||
// IndexChannel indexes a given channel. The userIDs are only populated
|
||||
// for private channels.
|
||||
IndexChannel(rctx request.CTX, channel *model.Channel, userIDs, teamMemberIDs []string) *model.AppError
|
||||
SearchChannels(teamId, userID, term string, isGuest bool) ([]string, *model.AppError)
|
||||
SearchChannels(teamId, userID, term string, isGuest, includeDeleted bool) ([]string, *model.AppError)
|
||||
DeleteChannel(channel *model.Channel) *model.AppError
|
||||
IndexUser(rctx request.CTX, user *model.User, teamsIds, channelsIds []string) *model.AppError
|
||||
SearchUsersInChannel(teamId, channelId string, restrictedToChannels []string, term string, options *model.UserSearchOptions) ([]string, []string, *model.AppError)
|
||||
|
||||
@@ -557,9 +557,9 @@ func (_m *SearchEngineInterface) RefreshIndexes(rctx request.CTX) *model.AppErro
|
||||
return r0
|
||||
}
|
||||
|
||||
// SearchChannels provides a mock function with given fields: teamId, userID, term, isGuest
|
||||
func (_m *SearchEngineInterface) SearchChannels(teamId string, userID string, term string, isGuest bool) ([]string, *model.AppError) {
|
||||
ret := _m.Called(teamId, userID, term, isGuest)
|
||||
// SearchChannels provides a mock function with given fields: teamId, userID, term, isGuest, includeDeleted
|
||||
func (_m *SearchEngineInterface) SearchChannels(teamId string, userID string, term string, isGuest bool, includeDeleted bool) ([]string, *model.AppError) {
|
||||
ret := _m.Called(teamId, userID, term, isGuest, includeDeleted)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for SearchChannels")
|
||||
@@ -567,19 +567,19 @@ func (_m *SearchEngineInterface) SearchChannels(teamId string, userID string, te
|
||||
|
||||
var r0 []string
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, string, string, bool) ([]string, *model.AppError)); ok {
|
||||
return rf(teamId, userID, term, isGuest)
|
||||
if rf, ok := ret.Get(0).(func(string, string, string, bool, bool) ([]string, *model.AppError)); ok {
|
||||
return rf(teamId, userID, term, isGuest, includeDeleted)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string, string, bool) []string); ok {
|
||||
r0 = rf(teamId, userID, term, isGuest)
|
||||
if rf, ok := ret.Get(0).(func(string, string, string, bool, bool) []string); ok {
|
||||
r0 = rf(teamId, userID, term, isGuest, includeDeleted)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]string)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string, string, bool) *model.AppError); ok {
|
||||
r1 = rf(teamId, userID, term, isGuest)
|
||||
if rf, ok := ret.Get(1).(func(string, string, string, bool, bool) *model.AppError); ok {
|
||||
r1 = rf(teamId, userID, term, isGuest, includeDeleted)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
|
||||
Ссылка в новой задаче
Block a user