mirror of https://github.com/Xhofe/alist
* fix(search): the problem of not returning in time when index does not support auto update. * fix(search): the problem of duplicate indexing of folders.pull/5826/head
parent
47f4b05517
commit
53926d5cd0
|
@ -211,14 +211,15 @@ func Update(parent string, objs []model.Obj) {
|
||||||
}
|
}
|
||||||
for i := range objs {
|
for i := range objs {
|
||||||
if toAdd.Contains(objs[i].GetName()) {
|
if toAdd.Contains(objs[i].GetName()) {
|
||||||
log.Debugf("add index: %s", path.Join(parent, objs[i].GetName()))
|
if !objs[i].IsDir() {
|
||||||
err = Index(ctx, parent, objs[i])
|
log.Debugf("add index: %s", path.Join(parent, objs[i].GetName()))
|
||||||
if err != nil {
|
err = Index(ctx, parent, objs[i])
|
||||||
log.Errorf("update search index error while index new node: %+v", err)
|
if err != nil {
|
||||||
return
|
log.Errorf("update search index error while index new node: %+v", err)
|
||||||
}
|
return
|
||||||
// build index if it's a folder
|
}
|
||||||
if objs[i].IsDir() {
|
} else {
|
||||||
|
// build index if it's a folder
|
||||||
dir := path.Join(parent, objs[i].GetName())
|
dir := path.Join(parent, objs[i].GetName())
|
||||||
err = BuildIndex(ctx,
|
err = BuildIndex(ctx,
|
||||||
[]string{dir},
|
[]string{dir},
|
||||||
|
|
|
@ -51,6 +51,7 @@ func UpdateIndex(c *gin.Context) {
|
||||||
}
|
}
|
||||||
if !search.Config(c).AutoUpdate {
|
if !search.Config(c).AutoUpdate {
|
||||||
common.ErrorStrResp(c, "update is not supported for current index", 400)
|
common.ErrorStrResp(c, "update is not supported for current index", 400)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
Loading…
Reference in New Issue