mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-06-12 23:59:50 +02:00
f00b978801
This reverts commit 039a9a4cc7
.
34 lines
814 B
Rust
34 lines
814 B
Rust
pub mod criterion;
|
|
mod query_builder;
|
|
mod distinct_map;
|
|
|
|
use crate::{Match, DocumentId};
|
|
|
|
pub use self::query_builder::{FilterFunc, QueryBuilder, DistinctQueryBuilder};
|
|
|
|
#[inline]
|
|
fn match_query_index(a: &Match, b: &Match) -> bool {
|
|
a.query_index == b.query_index
|
|
}
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct Document {
|
|
pub id: DocumentId,
|
|
pub matches: Vec<Match>,
|
|
}
|
|
|
|
impl Document {
|
|
pub fn new(doc: DocumentId, match_: Match) -> Self {
|
|
unsafe { Self::from_sorted_matches(doc, vec![match_]) }
|
|
}
|
|
|
|
pub fn from_matches(doc: DocumentId, mut matches: Vec<Match>) -> Self {
|
|
matches.sort_unstable();
|
|
unsafe { Self::from_sorted_matches(doc, matches) }
|
|
}
|
|
|
|
pub unsafe fn from_sorted_matches(id: DocumentId, matches: Vec<Match>) -> Self {
|
|
Self { id, matches }
|
|
}
|
|
}
|