fix(search): always descend into directories during IndexSpace walk
The SkipDir optimization skipped entire subtrees when a directory was already indexed with a matching mtime. After a failed indexing run (e.g. Tika crash), this permanently prevented unindexed children from being visited since the parent directory's mtime doesn't change when child extraction fails. With O(1) DocID lookups the per-file skip check is negligible, making SkipDir unnecessary for correctness. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
0cfa1ad3f0
commit
2cc1640085
2 files changed
+16
-2
No files matched your search
@@ -0,0 +1,11 @@
|
||||
Bugfix: Always descend into directories during space reindexing
|
||||
|
||||
The search indexer's `IndexSpace` walk previously used `filepath.SkipDir`
|
||||
to skip entire directory subtrees when the directory itself was already
|
||||
indexed. After a failed or interrupted indexing run (e.g. Tika crash),
|
||||
this caused thousands of unindexed files to be permanently skipped
|
||||
because the parent directory's mtime had not changed. The indexer now
|
||||
always descends into directories, relying on the O(1) per-file DocID
|
||||
lookup to skip already-indexed files efficiently.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/XXXX
|
||||
@@ -469,8 +469,11 @@ func (s *Service) IndexSpace(spaceID *provider.StorageSpaceId) error {
|
||||
docMtime, parseErr := time.Parse(time.RFC3339Nano, r.Mtime)
|
||||
if parseErr == nil && !docMtime.Before(fileMtime) {
|
||||
if info.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER {
|
||||
s.logger.Debug().Str("path", ref.Path).Msg("subtree hasn't changed. Skipping.")
|
||||
return filepath.SkipDir
|
||||
// Always descend into directories — a directory's
|
||||
// mtime only reflects direct child add/remove, not
|
||||
// whether all children were successfully indexed.
|
||||
// With O(1) DocID lookups the cost is negligible.
|
||||
return nil
|
||||
}
|
||||
s.logger.Debug().Str("path", ref.Path).Msg("element hasn't changed. Skipping.")
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user