From 485480560ad0b000f61e91a31301e2a6f167530a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 10 Oct 2019 15:17:13 +0200 Subject: [PATCH] Add method to create a query builder along with criterion --- meilidb-core/src/store/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/meilidb-core/src/store/mod.rs b/meilidb-core/src/store/mod.rs index b8cb947ee..900f0a041 100644 --- a/meilidb-core/src/store/mod.rs +++ b/meilidb-core/src/store/mod.rs @@ -17,8 +17,9 @@ pub use self::updates_results::UpdatesResults; use std::collections::HashSet; use meilidb_schema::{Schema, SchemaAttr}; use serde::de; -use crate::{update, query_builder::QueryBuilder, DocumentId, MResult, Error}; +use crate::criterion::Criteria; use crate::serde::Deserializer; +use crate::{update, query_builder::QueryBuilder, DocumentId, MResult, Error}; fn aligned_to(bytes: &[u8], align: usize) -> bool { (bytes as *const _ as *const () as usize) % align == 0 @@ -164,6 +165,10 @@ impl Index { pub fn query_builder(&self) -> QueryBuilder { QueryBuilder::new(self.main, self.postings_lists, self.synonyms) } + + pub fn query_builder_with_criteria<'c>(&self, criteria: Criteria<'c>) -> QueryBuilder<'c> { + QueryBuilder::with_criteria(self.main, self.postings_lists, self.synonyms, criteria) + } } pub fn create(