pub struct JSONLoader {
pub path: PathBuf,
pub content_key: Option<String>,
pub preserve_raw: bool,
}Expand description
JSON document loader
Supports loading JSON files, optionally using a specific field as the document content.
- For a JSON array, each element becomes one document
- For a JSON object, the whole object becomes one document (or a specified field)
Fields§
§path: PathBufJSON file path
content_key: Option<String>The field name used as the document content (optional) If specified, that field’s value is extracted as the content
preserve_raw: boolWhether to keep the raw JSON as metadata
Implementations§
Source§impl JSONLoader
impl JSONLoader
Sourcepub fn new_with_content_key(
path: impl Into<PathBuf>,
content_key: impl Into<String>,
) -> Self
pub fn new_with_content_key( path: impl Into<PathBuf>, content_key: impl Into<String>, ) -> Self
Creates a JSON loader with a content field
§Arguments
path- the JSON file pathcontent_key- the field name used as the document content
Sourcepub fn with_preserve_raw(self, preserve: bool) -> Self
pub fn with_preserve_raw(self, preserve: bool) -> Self
Sets whether to keep the raw JSON
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JSONLoader
impl RefUnwindSafe for JSONLoader
impl Send for JSONLoader
impl Sync for JSONLoader
impl Unpin for JSONLoader
impl UnsafeUnpin for JSONLoader
impl UnwindSafe for JSONLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more