Filter by mime

This commit is contained in:
2026-03-15 10:20:15 -07:00
parent 8041fc7531
commit 979fbb9b0d
30 changed files with 258 additions and 93 deletions

View File

@@ -2,6 +2,7 @@ use chrono::{DateTime, Utc};
use pile_config::{ConfigToml, Label, Source, objectpath::ObjectPath};
use pile_toolbox::cancelabletask::{CancelFlag, CancelableTaskError};
use pile_value::{
extract::traits::ExtractState,
source::{DataSource, DirDataSource, S3DataSource, misc::path_ts_earliest},
value::{Item, PileValue},
};
@@ -187,6 +188,7 @@ impl Datasets {
/// Returns `None` if the item or field is not found.
pub async fn get_field(
&self,
state: &ExtractState,
source: &Label,
key: &str,
path: &ObjectPath,
@@ -196,11 +198,11 @@ impl Datasets {
};
let item = PileValue::Item(item);
let Some(value) = item.query(path).await? else {
let Some(value) = item.query(state, path).await? else {
return Ok(None);
};
Ok(Some(value.to_json().await?))
Ok(Some(value.to_json(state).await?))
}
//
@@ -210,6 +212,7 @@ impl Datasets {
/// Refresh this dataset's fts index.
pub async fn fts_refresh(
&self,
state: &ExtractState,
_threads: usize,
flag: Option<CancelFlag>,
) -> Result<(), CancelableTaskError<DatasetError>> {
@@ -265,9 +268,10 @@ impl Datasets {
let item = item_result.map_err(DatasetError::from)?;
let db = Arc::clone(&db_index);
let state = state.clone();
join_set.spawn(async move {
let key = item.key();
let result = db.entry_to_document(&item).await;
let result = db.entry_to_document(&state, &item).await;
(key, result)
});