This commit is contained in:
Loïc Lecrenier 2023-03-23 09:12:35 +01:00
parent 01c7d2de8f
commit 9b1f439a91
4 changed files with 26 additions and 24 deletions

View File

@ -35,7 +35,25 @@ fn main() -> Result<(), Box<dyn Error>> {
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<dyn Error>> {
// 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()

View File

@ -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()),
]);

View File

@ -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!();
}
}
}

View File

@ -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<Item = Interned<Phrase>> + Clone + '_ {
todo!("self.phrase");
self.split_words.iter().chain(self.synonyms.iter()).copied()
}
pub fn is_empty(&self) -> bool {