mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-30 00:34:26 +01:00
WIP
This commit is contained in:
parent
01c7d2de8f
commit
9b1f439a91
@ -35,7 +35,25 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
let txn = index.read_txn()?;
|
let txn = index.read_txn()?;
|
||||||
let mut query = String::new();
|
let mut query = String::new();
|
||||||
while stdin().read_line(&mut query)? > 0 {
|
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 start = Instant::now();
|
||||||
// let mut logger = milli::DetailedSearchLogger::new("log");
|
// let mut logger = milli::DetailedSearchLogger::new("log");
|
||||||
let mut ctx = SearchContext::new(&index, &txn);
|
let mut ctx = SearchContext::new(&index, &txn);
|
||||||
@ -76,23 +94,6 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
// println!("{document}");
|
// 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
|
// let documents = index
|
||||||
// .documents(&txn, docs.documents_ids.iter().copied())
|
// .documents(&txn, docs.documents_ids.iter().copied())
|
||||||
// .unwrap()
|
// .unwrap()
|
||||||
|
@ -10,7 +10,7 @@ fn main() {
|
|||||||
let mut options = EnvOpenOptions::new();
|
let mut options = EnvOpenOptions::new();
|
||||||
options.map_size(100 * 1024 * 1024 * 1024); // 100 GB
|
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 mut wtxn = index.write_txn().unwrap();
|
||||||
|
|
||||||
let config = IndexerConfig::default();
|
let config = IndexerConfig::default();
|
||||||
@ -23,6 +23,8 @@ fn main() {
|
|||||||
Criterion::Words,
|
Criterion::Words,
|
||||||
Criterion::Typo,
|
Criterion::Typo,
|
||||||
Criterion::Proximity,
|
Criterion::Proximity,
|
||||||
|
Criterion::Attribute,
|
||||||
|
Criterion::Exactness,
|
||||||
// Criterion::Asc("release_date".to_owned()),
|
// Criterion::Asc("release_date".to_owned()),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -185,21 +185,21 @@ fn get_ranking_rules_for_query_graph_search<'ctx>(
|
|||||||
if attribute {
|
if attribute {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
todo!();
|
// todo!();
|
||||||
// attribute = false;
|
// attribute = false;
|
||||||
}
|
}
|
||||||
crate::Criterion::Sort => {
|
crate::Criterion::Sort => {
|
||||||
if sort {
|
if sort {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
todo!();
|
// todo!();
|
||||||
// sort = false;
|
// sort = false;
|
||||||
}
|
}
|
||||||
crate::Criterion::Exactness => {
|
crate::Criterion::Exactness => {
|
||||||
if exactness {
|
if exactness {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
todo!();
|
// todo!();
|
||||||
// exactness = false;
|
// exactness = false;
|
||||||
}
|
}
|
||||||
crate::Criterion::Asc(field) => {
|
crate::Criterion::Asc(field) => {
|
||||||
@ -214,7 +214,7 @@ fn get_ranking_rules_for_query_graph_search<'ctx>(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
desc.insert(field);
|
desc.insert(field);
|
||||||
todo!();
|
// todo!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,6 @@ impl QueryTerm {
|
|||||||
///
|
///
|
||||||
/// This excludes synonyms, split words, and words stored in the prefix databases.
|
/// This excludes synonyms, split words, and words stored in the prefix databases.
|
||||||
pub fn all_phrases(&'_ self) -> impl Iterator<Item = Interned<Phrase>> + Clone + '_ {
|
pub fn all_phrases(&'_ self) -> impl Iterator<Item = Interned<Phrase>> + Clone + '_ {
|
||||||
todo!("self.phrase");
|
|
||||||
self.split_words.iter().chain(self.synonyms.iter()).copied()
|
self.split_words.iter().chain(self.synonyms.iter()).copied()
|
||||||
}
|
}
|
||||||
pub fn is_empty(&self) -> bool {
|
pub fn is_empty(&self) -> bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user