get channel id for bookmark files in ES/OS (#28221)
Co-authored-by: Miguel de la Cruz <mgdelacroix@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
987a25b4d0
Коммит
d6c11d1d26
@@ -20,16 +20,25 @@ func (s SearchFileInfoStore) indexFile(rctx request.CTX, file *model.FileInfo) {
|
|||||||
for _, engine := range s.rootStore.searchEngine.GetActiveEngines() {
|
for _, engine := range s.rootStore.searchEngine.GetActiveEngines() {
|
||||||
if engine.IsIndexingEnabled() {
|
if engine.IsIndexingEnabled() {
|
||||||
runIndexFn(rctx, engine, func(engineCopy searchengine.SearchEngineInterface) {
|
runIndexFn(rctx, engine, func(engineCopy searchengine.SearchEngineInterface) {
|
||||||
if file.PostId == "" {
|
if file.PostId == "" && file.CreatorId != model.BookmarkFileOwner {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
post, postErr := s.rootStore.Post().GetSingle(rctx, file.PostId, false)
|
channelId := file.ChannelId
|
||||||
if postErr != nil {
|
if file.PostId != "" {
|
||||||
rctx.Logger().Error("Couldn't get post for file for SearchEngine indexing.", mlog.String("post_id", file.PostId), mlog.String("search_engine", engineCopy.GetName()), mlog.String("file_info_id", file.Id), mlog.Err(postErr))
|
post, postErr := s.rootStore.Post().GetSingle(rctx, file.PostId, false)
|
||||||
|
if postErr != nil {
|
||||||
|
rctx.Logger().Error("Couldn't get post for file for SearchEngine indexing.", mlog.String("post_id", file.PostId), mlog.String("search_engine", engineCopy.GetName()), mlog.String("file_info_id", file.Id), mlog.Err(postErr))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
channelId = post.ChannelId
|
||||||
|
}
|
||||||
|
|
||||||
|
if channelId == "" {
|
||||||
|
rctx.Logger().Error("Couldn't associate file with a channel for file for SearchEngine indexing.", mlog.String("search_engine", engineCopy.GetName()), mlog.String("file_info_id", file.Id))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := engineCopy.IndexFile(file, post.ChannelId); err != nil {
|
if err := engineCopy.IndexFile(file, channelId); err != nil {
|
||||||
rctx.Logger().Error("Encountered error indexing file", mlog.String("file_info_id", file.Id), mlog.String("search_engine", engineCopy.GetName()), mlog.Err(err))
|
rctx.Logger().Error("Encountered error indexing file", mlog.String("file_info_id", file.Id), mlog.String("search_engine", engineCopy.GetName()), mlog.Err(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ var searchFileInfoStoreTests = []searchTest{
|
|||||||
{
|
{
|
||||||
Name: "Should search files part of channel bookmarks",
|
Name: "Should search files part of channel bookmarks",
|
||||||
Fn: testFileInfoSearchShowChannelBookmarkFiles,
|
Fn: testFileInfoSearchShowChannelBookmarkFiles,
|
||||||
Tags: []string{EnginePostgres, EngineMySQL},
|
Tags: []string{EnginePostgres, EngineMySQL, EngineElasticSearch},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user