[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
@@ -860,7 +860,7 @@ func (os *OpensearchInterfaceImpl) IndexChannel(rctx request.CTX, channel *model
|
||||
return nil
|
||||
}
|
||||
|
||||
func (os *OpensearchInterfaceImpl) SearchChannels(teamId, userID string, term string, isGuest bool) ([]string, *model.AppError) {
|
||||
func (os *OpensearchInterfaceImpl) SearchChannels(teamId, userID string, term string, isGuest, includeDeleted bool) ([]string, *model.AppError) {
|
||||
os.mutex.RLock()
|
||||
defer os.mutex.RUnlock()
|
||||
|
||||
@@ -925,6 +925,14 @@ func (os *OpensearchInterfaceImpl) SearchChannels(teamId, userID string, term st
|
||||
})
|
||||
}
|
||||
|
||||
if !includeDeleted {
|
||||
query.Filter = append(query.Filter, types.Query{
|
||||
Term: map[string]types.TermQuery{
|
||||
"delete_at": {Value: 0},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
buf, err := json.Marshal(search.Request{
|
||||
Query: &types.Query{Bool: query},
|
||||
})
|
||||
|
||||
Ссылка в новой задаче
Block a user