pub struct Searcher<D: Directory + 'static> { /* private fields */ }Expand description
Searcher - provides search over loaded segments
For wasm/read-only use, create via Searcher::open().
For native use with Index, this is created via IndexReader.
Implementations§
Source§impl<D: Directory + 'static> Searcher<D>
impl<D: Directory + 'static> Searcher<D>
Sourcepub async fn open(
directory: Arc<D>,
schema: Arc<Schema>,
segment_ids: &[String],
term_cache_blocks: usize,
) -> Result<Self>
pub async fn open( directory: Arc<D>, schema: Arc<Schema>, segment_ids: &[String], term_cache_blocks: usize, ) -> Result<Self>
Create a Searcher directly from segment IDs
This is a simpler initialization path that doesn’t require SegmentManager. Use this for read-only access to pre-built indexes.
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
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
Sourcepub async fn query(
&self,
query_str: &str,
limit: usize,
) -> Result<SearchResponse>
pub async fn query( &self, query_str: &str, limit: usize, ) -> Result<SearchResponse>
Parse query string and search (convenience method)
Sourcepub async fn query_offset(
&self,
query_str: &str,
limit: usize,
offset: usize,
) -> Result<SearchResponse>
pub async fn query_offset( &self, query_str: &str, limit: usize, offset: usize, ) -> Result<SearchResponse>
Parse query string and search with offset (convenience method)
Sourcepub fn query_parser(&self) -> QueryLanguageParser
pub fn query_parser(&self) -> QueryLanguageParser
Get query parser for this searcher
Sourcepub async fn get_document(
&self,
address: &DocAddress,
) -> Result<Option<Document>>
pub async fn get_document( &self, address: &DocAddress, ) -> Result<Option<Document>>
Get a document by address (segment_id + doc_id)
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
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> 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>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.