Skip to content

Commit fe7d1a5

Browse files
committed
Enhance indexing functionality with scope management
- Updated the `EphemeralIndexCache` to support indexing scope, allowing differentiation between current and recursive indexing. - Modified methods to create and mark indexing complete with scope parameters, improving cache management and preventing redundant scans. - Refactored path resolution logic in `EphemeralIndex` to handle symlinks and ensure accurate entry retrieval. - Adjusted related components to utilize the new indexing scope, enhancing overall indexing efficiency and accuracy.
1 parent e44261d commit fe7d1a5

File tree

5 files changed

+262
-57
lines changed

5 files changed

+262
-57
lines changed

core/src/ops/files/query/directory_listing.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::{
1212
video_media_data,
1313
},
1414
infra::query::LibraryQuery,
15+
ops::indexing::IndexScope,
1516
};
1617
use sea_orm::{
1718
ColumnTrait, ConnectionTrait, DatabaseConnection, EntityTrait, JoinType, QueryFilter,
@@ -753,7 +754,7 @@ impl DirectoryListingQuery {
753754
// Get library to dispatch indexer job
754755
if let Some(library) = context.get_library(library_id).await {
755756
// Create cache entry and get the index to share with the job
756-
let ephemeral_index = cache.create_for_indexing(local_path.clone());
757+
let ephemeral_index = cache.create_for_indexing(local_path.clone(), IndexScope::Current);
757758

758759
// Clear any stale entries from previous indexing (prevents ghost files)
759760
let cleared = cache.clear_for_reindex(&local_path).await;
@@ -790,7 +791,7 @@ impl DirectoryListingQuery {
790791
e
791792
);
792793
// Mark indexing as not in progress since job failed
793-
cache.mark_indexing_complete(&local_path);
794+
cache.mark_indexing_complete(&local_path, IndexScope::Current);
794795
}
795796
}
796797
}

0 commit comments

Comments
 (0)