Struct tantivy::Searcher [−][src]
Holds a list of SegmentReader
s ready for search.
It guarantees that the Segment
will not be removed before
the destruction of the Searcher
.
Implementations
impl Searcher
[src]
pub fn index(&self) -> &Index
[src]
Returns the Index
associated to the Searcher
pub fn doc(&self, doc_address: DocAddress) -> Result<Document>
[src]
Fetches a document from tantivy's store given a DocAddress
.
The searcher uses the segment ordinal to route the
the request to the right Segment
.
pub fn schema(&self) -> &Schema
[src]
Access the schema associated to the index of this searcher.
pub fn num_docs(&self) -> u64
[src]
Returns the overall number of documents in the index.
pub fn doc_freq(&self, term: &Term) -> Result<u64>
[src]
Return the overall number of documents containing the given term.
pub fn segment_readers(&self) -> &[SegmentReader]ⓘ
[src]
Return the list of segment readers
pub fn segment_reader(&self, segment_ord: u32) -> &SegmentReader
[src]
Returns the segment_reader associated with the given segment_ordinal
pub fn search<C: Collector>(
&self,
query: &dyn Query,
collector: &C
) -> Result<C::Fruit>
[src]
&self,
query: &dyn Query,
collector: &C
) -> Result<C::Fruit>
Runs a query on the segment readers wrapped by the searcher.
Search works as follows :
First the weight object associated to the query is created.
Then, the query loops over the segments and for each segment :
- setup the collector and informs it that the segment being processed has changed.
- creates a SegmentCollector for collecting documents associated to the segment
- creates a
Scorer
object associated for this segment - iterate through the matched documents and push them to the segment collector.
Finally, the Collector merges each of the child collectors into itself for result usability by the caller.
pub fn search_with_executor<C: Collector>(
&self,
query: &dyn Query,
collector: &C,
executor: &Executor
) -> Result<C::Fruit>
[src]
&self,
query: &dyn Query,
collector: &C,
executor: &Executor
) -> Result<C::Fruit>
Same as search(...)
but multithreaded.
The current implementation is rather naive : multithreading is by splitting search into as many task as there are segments.
It is powerless at making search faster if your index consists in one large segment.
Also, keep in my multithreading a single query on several threads will not improve your throughput. It can actually hurt it. It will however, decrease the average response time.
pub fn space_usage(&self) -> Result<SearcherSpaceUsage>
[src]
Summarize total space usage of this searcher.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Searcher
[src]
impl Send for Searcher
[src]
impl Sync for Searcher
[src]
impl Unpin for Searcher
[src]
impl !UnwindSafe for Searcher
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T> Fruit for T where
T: Send + Downcast,
[src]
T: Send + Downcast,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,