mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
feat: Remove the FilterFunc alias type
This commit is contained in:
parent
19e67dcf0b
commit
5d5bcf7011
@ -15,7 +15,7 @@ use slice_group_by::GroupBy;
|
||||
use rayon::slice::ParallelSliceMut;
|
||||
|
||||
pub use self::index::{Index, IndexBuilder};
|
||||
pub use self::query_builder::{FilterFunc, QueryBuilder, DistinctQueryBuilder};
|
||||
pub use self::query_builder::{QueryBuilder, DistinctQueryBuilder};
|
||||
|
||||
/// Represent an internally generated document unique identifier.
|
||||
///
|
||||
|
@ -35,16 +35,14 @@ fn generate_automatons(query: &str) -> Vec<DfaExt> {
|
||||
automatons
|
||||
}
|
||||
|
||||
pub type FilterFunc = fn(DocumentId) -> bool;
|
||||
|
||||
pub struct QueryBuilder<'i, 'c, FI> {
|
||||
pub struct QueryBuilder<'i, 'c, FI = fn(DocumentId) -> bool> {
|
||||
index: &'i Index,
|
||||
criteria: Criteria<'c>,
|
||||
searchable_attrs: Option<HashSet<u16>>,
|
||||
filter: Option<FI>,
|
||||
}
|
||||
|
||||
impl<'i, 'c> QueryBuilder<'i, 'c, FilterFunc> {
|
||||
impl<'i, 'c> QueryBuilder<'i, 'c, fn(DocumentId) -> bool> {
|
||||
pub fn new(index: &'i Index) -> Self {
|
||||
QueryBuilder::with_criteria(index, Criteria::default())
|
||||
}
|
||||
|
@ -6,8 +6,7 @@ use std::{fmt, marker};
|
||||
use rocksdb::rocksdb_options::{ReadOptions, EnvOptions, ColumnFamilyOptions};
|
||||
use rocksdb::rocksdb::{DB, DBVector, Snapshot, SeekKey, SstFileWriter};
|
||||
use serde::de::DeserializeOwned;
|
||||
use meilidb_core::{Index, QueryBuilder, FilterFunc};
|
||||
use meilidb_core::DocumentId;
|
||||
use meilidb_core::{Index, QueryBuilder, DocumentId};
|
||||
|
||||
use crate::database::{retrieve_data_schema, retrieve_data_index, retrieve_data_ranked_map, retrieve_config};
|
||||
use crate::database::serde::deserializer::Deserializer;
|
||||
@ -84,7 +83,7 @@ where D: Deref<Target=DB>
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn query_builder(&self) -> QueryBuilder<FilterFunc> {
|
||||
pub fn query_builder(&self) -> QueryBuilder {
|
||||
QueryBuilder::new(self.index())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user