Skip to main content

MultiSearch

Struct MultiSearch 

Source
pub struct MultiSearch<U> { /* private fields */ }
Expand description

A typed query across every index of a FlussoMultiDocument union — the blended counterpart of Search, with the same clause builder and the same client-free shape.

Hits come back in one relevance-ranked list; from/size page that blended list, not each index. Terminals: send for a typed page of union values, count for the total matches across all the indexes.

Implementations§

Source§

impl<U: FlussoMultiDocument> MultiSearch<U>

Source

pub fn new() -> Self

Start a query across the union’s indexes (usually via FlussoMultiDocument::query).

Source

pub fn query(self, query: impl AsQuery<Root>) -> Self

A scoring clause (bool.must). Root-scope queries from any of the union’s document types compose here; a field unmapped in one index simply doesn’t match there. An absent clause adds nothing.

Source

pub fn filter(self, query: impl AsQuery<Root>) -> Self

A non-scoring, cacheable clause (bool.filter). An absent clause adds nothing — so filter(opt.map(|v| handle.eq(v))) is a conditional filter.

Source

pub fn must_not(self, query: impl AsQuery<Root>) -> Self

An exclusion clause (bool.must_not). An absent clause excludes nothing.

Source

pub fn should(self, query: impl AsQuery<Root>) -> Self

An optional, scoring clause (bool.should). An absent clause adds nothing.

Source

pub fn sort(self, sort: Sort) -> Self

Append a sort key. It applies to the blended list, so the field must exist in every index of the union (or carry an unmapped_type in its options) — OpenSearch rejects a sort on a field one index lacks. Relevance (no sort) is always safe.

Source

pub fn from(self, from: u64) -> Self

Offset of the first hit to return, in the blended list.

Source

pub fn size(self, size: u64) -> Self

Maximum number of hits to return, across all the indexes combined.

Source

pub fn raw(self, query: Value) -> Self

Replace the query body with a raw OpenSearch query DSL value. The pressure-release valve, as on Search; hits still decode into the union.

Source

pub fn physical_path(&self) -> &str

The comma-joined physical index list this query addresses — one {index}_{hash} per union variant. For logging and debugging.

Source

pub fn body(&self) -> Value

The request body this search will POST to _search. Pure — useful for tests and debugging.

Source

pub fn count_body(&self) -> Value

The request body count will POST to _count: just the query (as on Search::count_body).

Source

pub async fn send(&self, client: &Client) -> Result<SearchResponse<U>>

Execute the search and decode the blended hits into the union.

Source

pub async fn count(&self, client: &Client) -> Result<u64>

Count the matches across all the union’s indexes, without fetching any hits.

Trait Implementations§

Source§

impl<U: Clone> Clone for MultiSearch<U>

Source§

fn clone(&self) -> MultiSearch<U>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<U: Debug> Debug for MultiSearch<U>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<U: FlussoMultiDocument> Default for MultiSearch<U>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<U> Freeze for MultiSearch<U>

§

impl<U> RefUnwindSafe for MultiSearch<U>

§

impl<U> Send for MultiSearch<U>

§

impl<U> Sync for MultiSearch<U>

§

impl<U> Unpin for MultiSearch<U>

§

impl<U> UnsafeUnpin for MultiSearch<U>

§

impl<U> UnwindSafe for MultiSearch<U>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more