mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
feat: Allow filtering on QueryBuilder
This commit is contained in:
parent
aa3d059363
commit
7132c3be89
@ -124,7 +124,14 @@ impl<'a, D, FI> QueryBuilder<'a, D, FI>
|
|||||||
where D: Deref<Target=DB>,
|
where D: Deref<Target=DB>,
|
||||||
FI: Fn(DocumentId, &DatabaseView<D>) -> bool,
|
FI: Fn(DocumentId, &DatabaseView<D>) -> bool,
|
||||||
{
|
{
|
||||||
pub fn query(&self, query: &str, range: Range<usize>) -> Vec<Document> {
|
pub fn query(self, query: &str, range: Range<usize>) -> Vec<Document> {
|
||||||
|
// We give the filtering work to the query distinct builder,
|
||||||
|
// specifying a distinct rule that has no effect.
|
||||||
|
if self.filter.is_some() {
|
||||||
|
let builder = self.with_distinct(|_, _| None as Option<()>, 1);
|
||||||
|
return builder.query(query, range);
|
||||||
|
}
|
||||||
|
|
||||||
let mut documents = self.query_all(query);
|
let mut documents = self.query_all(query);
|
||||||
let mut groups = vec![documents.as_mut_slice()];
|
let mut groups = vec![documents.as_mut_slice()];
|
||||||
let view = &self.view;
|
let view = &self.view;
|
||||||
|
Loading…
Reference in New Issue
Block a user