mirror of
https://github.com/AlistGo/alist.git
synced 2025-11-25 03:15:10 +08:00
fix(search): don't delete virtual folder while update indexes (close #2677)
This commit is contained in:
@@ -201,7 +201,7 @@ func Update(parent string, objs []model.Obj) {
|
||||
toDelete := old.Difference(now)
|
||||
toAdd := now.Difference(old)
|
||||
for i := range nodes {
|
||||
if toDelete.Contains(nodes[i].Name) {
|
||||
if toDelete.Contains(nodes[i].Name) && !op.HasStorage(path.Join(parent, nodes[i].Name)) {
|
||||
log.Debugf("delete index: %s", path.Join(parent, nodes[i].Name))
|
||||
err = instance.Del(ctx, path.Join(parent, nodes[i].Name))
|
||||
if err != nil {
|
||||
|
||||
@@ -18,7 +18,7 @@ type Searcher interface {
|
||||
Search(ctx context.Context, req model.SearchReq) ([]model.SearchNode, int64, error)
|
||||
// Index obj with parent
|
||||
Index(ctx context.Context, node model.SearchNode) error
|
||||
// Index obj with parent in batches
|
||||
// BatchIndex obj with parent
|
||||
BatchIndex(ctx context.Context, nodes []model.SearchNode) error
|
||||
// Get by parent
|
||||
Get(ctx context.Context, parent string) ([]model.SearchNode, error)
|
||||
|
||||
Reference in New Issue
Block a user