Write sidecar fields

This commit is contained in:
2026-03-06 15:16:35 -08:00
parent 22724eee3f
commit d51b8b51bf
11 changed files with 311 additions and 49 deletions

View File

@@ -21,7 +21,7 @@ use thiserror::Error;
use tracing::{debug, info, trace, warn};
use crate::{
DataSource, Item,
DataSource, FileItem,
index::{DbFtsIndex, FtsLookupResult},
path_ts_earliest,
source::DirDataSource,
@@ -96,11 +96,7 @@ impl Dataset {
// MARK: get
//
pub fn get(
&self,
source: &Label,
key: &PathBuf,
) -> Option<Box<dyn Item<Key = PathBuf> + 'static>> {
pub fn get(&self, source: &Label, key: &PathBuf) -> Option<FileItem> {
let s = self.config.dataset.source.get(source)?;
let s = match s {
Source::Filesystem { path, sidecars } => {
@@ -115,7 +111,7 @@ impl Dataset {
// MARK: fts
//
/// Refresh this dataset's fts index
/// Refresh this dataset's fts index.
pub fn fts_refresh(
&self,
threads: usize,
@@ -163,7 +159,7 @@ impl Dataset {
.install(|| {
batch
.into_par_iter()
.filter_map(|(key, item)| match db_index.entry_to_document(&*item) {
.filter_map(|(key, item)| match db_index.entry_to_document(&item) {
Ok(Some(doc)) => Some((key, doc)),
Ok(None) => {
warn!("Skipping {key:?}, document is empty");
@@ -306,7 +302,7 @@ fn start_read_task(
batch_size: usize,
) -> (
JoinHandle<()>,
Receiver<Result<Vec<(PathBuf, Box<dyn Item<Key = PathBuf>>)>, DatasetError>>,
Receiver<Result<Vec<(PathBuf, FileItem)>, DatasetError>>,
) {
let config = config.clone();
let (read_tx, read_rx) = std::sync::mpsc::sync_channel(2);