mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
feat: Make the QueryBuilder with_criteria use FilterFunc
This commit is contained in:
parent
d46fa4b215
commit
7a6166d229
@ -53,15 +53,15 @@ where D: Deref<Target=DB>
|
|||||||
pub fn new(view: &'a DatabaseView<D>) -> Result<Self, Box<Error>> {
|
pub fn new(view: &'a DatabaseView<D>) -> Result<Self, Box<Error>> {
|
||||||
QueryBuilder::with_criteria(view, Criteria::default())
|
QueryBuilder::with_criteria(view, Criteria::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn with_criteria(view: &'a DatabaseView<D>, criteria: Criteria) -> Result<Self, Box<Error>> {
|
||||||
|
Ok(QueryBuilder { view, criteria, filter: None })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, D, FI> QueryBuilder<'a, D, FI>
|
impl<'a, D, FI> QueryBuilder<'a, D, FI>
|
||||||
where D: Deref<Target=DB>,
|
where D: Deref<Target=DB>,
|
||||||
{
|
{
|
||||||
pub fn with_criteria(view: &'a DatabaseView<D>, criteria: Criteria) -> Result<Self, Box<Error>> {
|
|
||||||
Ok(QueryBuilder { view, criteria, filter: None })
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_filter<F>(self, function: F) -> QueryBuilder<'a, D, F>
|
pub fn with_filter<F>(self, function: F) -> QueryBuilder<'a, D, F>
|
||||||
where F: Fn(DocumentId, &DatabaseView<D>) -> bool,
|
where F: Fn(DocumentId, &DatabaseView<D>) -> bool,
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user