pub struct MapSearch<S = Root> { /* private fields */ }Expand description
A cross-key full-text query over a TextMap: one analyzed query matched
against every key, with optional per-key preference. Renders a multi_match
of type: best_fields over the preferred keys (each field^weight) plus the
wildcard path.* fallback, so the best-scoring key wins without
double-counting. only_preferred drops the fallback.
Implementations§
Source§impl<S> MapSearch<S>
impl<S> MapSearch<S>
Sourcepub fn prefer(self, key: impl AsRef<str>, weight: f32) -> Self
pub fn prefer(self, key: impl AsRef<str>, weight: f32) -> Self
Prefer a key, weighting its score by weight (path.key^weight). Add
several to rank keys (e.g. the user’s locale highest).
Sourcepub fn only_preferred(self) -> Self
pub fn only_preferred(self) -> Self
Search only the preferred keys — drop the path.* fallback that
otherwise also searches every other key.
Sourcepub fn operator(self, operator: impl Into<String>) -> Self
pub fn operator(self, operator: impl Into<String>) -> Self
Combine analyzed terms with "AND" or "OR" (default "OR").
Sourcepub fn fuzziness(self, fuzziness: impl Into<String>) -> Self
pub fn fuzziness(self, fuzziness: impl Into<String>) -> Self
Edit distance for analyzed terms — "AUTO" or an integer-as-string.
Sourcepub fn minimum_should_match(self, value: impl Into<String>) -> Self
pub fn minimum_should_match(self, value: impl Into<String>) -> Self
How many of the analyzed terms must match (e.g. "75%", "2").
Trait Implementations§
Source§impl<S> AsQuery<S> for MapSearch<S>
impl<S> AsQuery<S> for MapSearch<S>
Source§fn into_query(self) -> Option<Query<S>>
fn into_query(self) -> Option<Query<S>>
The clause this produces, or
None to contribute nothing.Source§fn and(self, other: impl AsQuery<S>) -> Query<S>where
Self: Sized,
fn and(self, other: impl AsQuery<S>) -> Query<S>where
Self: Sized,
self AND other. An absent side is the identity.Source§fn or(self, other: impl AsQuery<S>) -> Query<S>where
Self: Sized,
fn or(self, other: impl AsQuery<S>) -> Query<S>where
Self: Sized,
self OR other. An absent side is the identity.Auto Trait Implementations§
impl<S> Freeze for MapSearch<S>
impl<S> RefUnwindSafe for MapSearch<S>
impl<S> Send for MapSearch<S>
impl<S> Sync for MapSearch<S>
impl<S> Unpin for MapSearch<S>
impl<S> UnsafeUnpin for MapSearch<S>
impl<S> UnwindSafe for MapSearch<S>
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