mirror of
https://github.com/qdrant/qdrant.git
synced 2026-07-23 11:11:00 -05:00
fix FullTextIndexRead::check_match_batch
This commit is contained in:
@@ -84,13 +84,8 @@ pub trait FullTextIndexRead {
|
||||
&self,
|
||||
query: &ParsedQuery,
|
||||
items: impl Iterator<Item = (U, PointOffsetType)>,
|
||||
mut on_match: impl FnMut(U, bool),
|
||||
) -> OperationResult<()> {
|
||||
for (tag, point_id) in items {
|
||||
on_match(tag, self.check_match(query, point_id)?);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
on_match: impl FnMut(U, bool),
|
||||
) -> OperationResult<()>;
|
||||
|
||||
/// Walk the inverted-index vocab and emit one [`PayloadBlockCondition`] per
|
||||
/// token with at least `threshold` postings. Used to seed payload-block
|
||||
@@ -244,3 +239,17 @@ pub trait FullTextIndexRead {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Default [`check_match_batch`](FullTextIndexRead::check_match_batch) for
|
||||
/// in-RAM indexes: streams the single lookup, no IO to pipeline.
|
||||
pub fn default_check_match_batch<T: FullTextIndexRead + ?Sized, U: UserData>(
|
||||
this: &T,
|
||||
query: &ParsedQuery,
|
||||
items: impl Iterator<Item = (U, PointOffsetType)>,
|
||||
mut on_match: impl FnMut(U, bool),
|
||||
) -> OperationResult<()> {
|
||||
for (tag, point_id) in items {
|
||||
on_match(tag, this.check_match(query, point_id)?);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ use common::counter::hardware_counter::HardwareCounterCell;
|
||||
use common::types::PointOffsetType;
|
||||
use common::universal_io::{UniversalRead, UserData};
|
||||
|
||||
use super::super::full_text_index_read::FullTextIndexRead;
|
||||
use super::super::full_text_index_read::{FullTextIndexRead, default_check_match_batch};
|
||||
use super::super::inverted_index::{InvertedIndex, ParsedQuery, TokenId};
|
||||
use super::super::tokenizers::Tokenizer;
|
||||
use super::ImmutableFullTextIndex;
|
||||
@@ -63,6 +63,15 @@ impl<S: UniversalRead> FullTextIndexRead for ImmutableFullTextIndex<S> {
|
||||
self.inverted_index.check_match(query, point_id)
|
||||
}
|
||||
|
||||
fn check_match_batch<U: UserData>(
|
||||
&self,
|
||||
query: &ParsedQuery,
|
||||
items: impl Iterator<Item = (U, PointOffsetType)>,
|
||||
on_match: impl FnMut(U, bool),
|
||||
) -> OperationResult<()> {
|
||||
default_check_match_batch(self, query, items, on_match)
|
||||
}
|
||||
|
||||
fn for_each_payload_block_inner(
|
||||
&self,
|
||||
threshold: usize,
|
||||
|
||||
@@ -2,7 +2,7 @@ use common::counter::hardware_counter::HardwareCounterCell;
|
||||
use common::types::PointOffsetType;
|
||||
use common::universal_io::UserData;
|
||||
|
||||
use super::super::full_text_index_read::FullTextIndexRead;
|
||||
use super::super::full_text_index_read::{FullTextIndexRead, default_check_match_batch};
|
||||
use super::super::inverted_index::mutable_inverted_index::MutableInvertedIndex;
|
||||
use super::super::inverted_index::{InvertedIndex, ParsedQuery, TokenId};
|
||||
use super::super::tokenizers::Tokenizer;
|
||||
@@ -81,6 +81,15 @@ impl FullTextIndexRead for MutableFullTextIndexInner {
|
||||
self.inverted_index.check_match(query, point_id)
|
||||
}
|
||||
|
||||
fn check_match_batch<U: UserData>(
|
||||
&self,
|
||||
query: &ParsedQuery,
|
||||
items: impl Iterator<Item = (U, PointOffsetType)>,
|
||||
on_match: impl FnMut(U, bool),
|
||||
) -> OperationResult<()> {
|
||||
default_check_match_batch(self, query, items, on_match)
|
||||
}
|
||||
|
||||
fn for_each_payload_block_inner(
|
||||
&self,
|
||||
threshold: usize,
|
||||
|
||||
@@ -63,6 +63,15 @@ impl<S: UniversalRead> FullTextIndexRead for ReadOnlyAppendableFullTextIndex<S>
|
||||
self.inner.check_match(query, point_id)
|
||||
}
|
||||
|
||||
fn check_match_batch<U: UserData>(
|
||||
&self,
|
||||
query: &ParsedQuery,
|
||||
items: impl Iterator<Item = (U, PointOffsetType)>,
|
||||
on_match: impl FnMut(U, bool),
|
||||
) -> OperationResult<()> {
|
||||
self.inner.check_match_batch(query, items, on_match)
|
||||
}
|
||||
|
||||
fn for_each_payload_block_inner(
|
||||
&self,
|
||||
threshold: usize,
|
||||
|
||||
@@ -63,6 +63,15 @@ impl FullTextIndexRead for MutableFullTextIndex {
|
||||
self.inner.check_match(query, point_id)
|
||||
}
|
||||
|
||||
fn check_match_batch<U: UserData>(
|
||||
&self,
|
||||
query: &ParsedQuery,
|
||||
items: impl Iterator<Item = (U, PointOffsetType)>,
|
||||
on_match: impl FnMut(U, bool),
|
||||
) -> OperationResult<()> {
|
||||
self.inner.check_match_batch(query, items, on_match)
|
||||
}
|
||||
|
||||
fn for_each_payload_block_inner(
|
||||
&self,
|
||||
threshold: usize,
|
||||
|
||||
Reference in New Issue
Block a user