pub struct Searcher<D: DirectoryWriter + 'static> { /* private fields */ }Expand description
Searcher - holds segment snapshot for safe searching
Segments referenced by this reader won’t be deleted until the reader is dropped.
Implementations§
Source§impl<D: DirectoryWriter + 'static> Searcher<D>
impl<D: DirectoryWriter + 'static> Searcher<D>
Sourcepub fn segment_readers(&self) -> &[Arc<SegmentReader>]
pub fn segment_readers(&self) -> &[Arc<SegmentReader>]
Get segment readers
Sourcepub fn default_fields(&self) -> &[Field]
pub fn default_fields(&self) -> &[Field]
Get default fields for search
Sourcepub fn tokenizers(&self) -> &TokenizerRegistry
pub fn tokenizers(&self) -> &TokenizerRegistry
Get tokenizer registry
Sourcepub fn trained_centroids(&self) -> &FxHashMap<u32, Arc<CoarseCentroids>>
pub fn trained_centroids(&self) -> &FxHashMap<u32, Arc<CoarseCentroids>>
Get trained centroids
Sourcepub fn trained_codebooks(&self) -> &FxHashMap<u32, Arc<PQCodebook>>
pub fn trained_codebooks(&self) -> &FxHashMap<u32, Arc<PQCodebook>>
Get trained codebooks
Sourcepub fn global_stats(&self) -> &Arc<LazyGlobalStats>
pub fn global_stats(&self) -> &Arc<LazyGlobalStats>
Get lazy global statistics for cross-segment IDF computation
Statistics are computed lazily on first access and cached per term/dimension. The stats are bound to this Searcher’s segment set.
Sourcepub fn num_segments(&self) -> usize
pub fn num_segments(&self) -> usize
Get number of segments
Sourcepub async fn doc(&self, doc_id: u32) -> Result<Option<Document>>
pub async fn doc(&self, doc_id: u32) -> Result<Option<Document>>
Get a document by global doc_id
Sourcepub async fn search(
&self,
query: &dyn Query,
limit: usize,
) -> Result<Vec<SearchResult>>
pub async fn search( &self, query: &dyn Query, limit: usize, ) -> Result<Vec<SearchResult>>
Search across all segments and return aggregated results
Sourcepub async fn search_with_offset(
&self,
query: &dyn Query,
limit: usize,
offset: usize,
) -> Result<Vec<SearchResult>>
pub async fn search_with_offset( &self, query: &dyn Query, limit: usize, offset: usize, ) -> Result<Vec<SearchResult>>
Search with offset for pagination
Auto Trait Implementations§
impl<D> Freeze for Searcher<D>
impl<D> !RefUnwindSafe for Searcher<D>
impl<D> Send for Searcher<D>
impl<D> Sync for Searcher<D>
impl<D> Unpin for Searcher<D>
impl<D> !UnwindSafe for Searcher<D>
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
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>
Converts
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>
Converts
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> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.