From 9b1f439a917da71d5790baf77a390a210bea668d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Thu, 23 Mar 2023 09:12:35 +0100 Subject: [PATCH] WIP --- milli/examples/search.rs | 37 +++++++++++++++--------------- milli/examples/settings.rs | 4 +++- milli/src/search/new/mod.rs | 8 +++---- milli/src/search/new/query_term.rs | 1 - 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/milli/examples/search.rs b/milli/examples/search.rs index 558f92bac..57aac5a02 100644 --- a/milli/examples/search.rs +++ b/milli/examples/search.rs @@ -35,7 +35,25 @@ fn main() -> Result<(), Box> { let txn = index.read_txn()?; let mut query = String::new(); while stdin().read_line(&mut query)? > 0 { - for _ in 0..10 { + for _ in 0..2 { + let start = Instant::now(); + let mut s = Search::new(&txn, &index); + s.query( + // "which a the releases from poison by the government", + // "sun flower s are the best", + query.trim(), + ); + s.terms_matching_strategy(TermsMatchingStrategy::Last); + s.offset(0); + // s.limit(1); + // s.criterion_implementation_strategy( + // milli::CriterionImplementationStrategy::OnlySetBased, + // ); + + let docs = s.execute().unwrap(); + let elapsed = start.elapsed(); + println!("old: {}us, docids: {:?}", elapsed.as_micros(), docs.documents_ids); + let start = Instant::now(); // let mut logger = milli::DetailedSearchLogger::new("log"); let mut ctx = SearchContext::new(&index, &txn); @@ -76,23 +94,6 @@ fn main() -> Result<(), Box> { // println!("{document}"); // } - let start = Instant::now(); - let mut s = Search::new(&txn, &index); - s.query( - // "which a the releases from poison by the government", - // "sun flower s are the best", - query.trim(), - ); - s.terms_matching_strategy(TermsMatchingStrategy::Last); - // s.limit(1); - // s.criterion_implementation_strategy( - // milli::CriterionImplementationStrategy::OnlySetBased, - // ); - - let docs = s.execute().unwrap(); - let elapsed = start.elapsed(); - println!("old: {}us, docids: {:?}", elapsed.as_micros(), docs.documents_ids); - // let documents = index // .documents(&txn, docs.documents_ids.iter().copied()) // .unwrap() diff --git a/milli/examples/settings.rs b/milli/examples/settings.rs index fb9cf2789..a4ac3879f 100644 --- a/milli/examples/settings.rs +++ b/milli/examples/settings.rs @@ -10,7 +10,7 @@ fn main() { let mut options = EnvOpenOptions::new(); options.map_size(100 * 1024 * 1024 * 1024); // 100 GB - let index = Index::new(options, "data_wiki").unwrap(); + let index = Index::new(options, "data_movies").unwrap(); let mut wtxn = index.write_txn().unwrap(); let config = IndexerConfig::default(); @@ -23,6 +23,8 @@ fn main() { Criterion::Words, Criterion::Typo, Criterion::Proximity, + Criterion::Attribute, + Criterion::Exactness, // Criterion::Asc("release_date".to_owned()), ]); diff --git a/milli/src/search/new/mod.rs b/milli/src/search/new/mod.rs index e699d408f..9627a662e 100644 --- a/milli/src/search/new/mod.rs +++ b/milli/src/search/new/mod.rs @@ -185,21 +185,21 @@ fn get_ranking_rules_for_query_graph_search<'ctx>( if attribute { continue; } - todo!(); + // todo!(); // attribute = false; } crate::Criterion::Sort => { if sort { continue; } - todo!(); + // todo!(); // sort = false; } crate::Criterion::Exactness => { if exactness { continue; } - todo!(); + // todo!(); // exactness = false; } crate::Criterion::Asc(field) => { @@ -214,7 +214,7 @@ fn get_ranking_rules_for_query_graph_search<'ctx>( continue; } desc.insert(field); - todo!(); + // todo!(); } } } diff --git a/milli/src/search/new/query_term.rs b/milli/src/search/new/query_term.rs index 2b32fcd84..0ce000537 100644 --- a/milli/src/search/new/query_term.rs +++ b/milli/src/search/new/query_term.rs @@ -216,7 +216,6 @@ impl QueryTerm { /// /// This excludes synonyms, split words, and words stored in the prefix databases. pub fn all_phrases(&'_ self) -> impl Iterator> + Clone + '_ { - todo!("self.phrase"); self.split_words.iter().chain(self.synonyms.iter()).copied() } pub fn is_empty(&self) -> bool {