pub struct EngineBuilder { /* private fields */ }Expand description
Builder for constructing an Engine with custom configuration.
Use this when you need to specify a custom text analyzer or embedding
model. For simple cases with default settings (StandardAnalyzer, no
embedder), use Engine::new directly.
§Example
use std::sync::Arc;
let schema = Schema::builder()
.add_field("content", FieldOption::Text(TextOption::default()))
.add_field("content_vec", FieldOption::Flat(FlatOption { dimension: 384, ..Default::default() }))
.build();
let engine = Engine::builder(storage, schema)
.analyzer(Arc::new(StandardAnalyzer::default()))
.embedder(Arc::new(MyEmbedder))
.build()
.await?;Implementations§
Source§impl EngineBuilder
impl EngineBuilder
Sourcepub fn new(storage: Arc<dyn Storage>, schema: Schema) -> Self
pub fn new(storage: Arc<dyn Storage>, schema: Schema) -> Self
Create a new builder with the given storage and schema.
Sourcepub fn analyzer(self, analyzer: Arc<dyn Analyzer>) -> Self
pub fn analyzer(self, analyzer: Arc<dyn Analyzer>) -> Self
Set the analyzer for text fields.
Both simple analyzers (e.g., StandardAnalyzer) and PerFieldAnalyzer are
supported. When a PerFieldAnalyzer is passed, it is used directly (with _id
automatically set to KeywordAnalyzer if not already configured).
If not set, StandardAnalyzer is used as the default.
Sourcepub fn embedder(self, embedder: Arc<dyn Embedder>) -> Self
pub fn embedder(self, embedder: Arc<dyn Embedder>) -> Self
Set the embedder for vector fields.
Both simple embedders and PerFieldEmbedder
are supported. When a PerFieldEmbedder is passed, each vector field will use
the embedder registered for that field name, falling back to the default.
If not set, no embedder is configured.
Auto Trait Implementations§
impl Freeze for EngineBuilder
impl !RefUnwindSafe for EngineBuilder
impl Send for EngineBuilder
impl Sync for EngineBuilder
impl Unpin for EngineBuilder
impl UnsafeUnpin for EngineBuilder
impl !UnwindSafe for EngineBuilder
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.