2023-03-22 14:50:41 +01:00
|
|
|
// use big_s::S;
|
|
|
|
use heed::EnvOpenOptions;
|
|
|
|
// use maplit::hashset;
|
|
|
|
use milli::{
|
|
|
|
update::{IndexerConfig, Settings},
|
2023-11-08 10:45:06 +01:00
|
|
|
Index, RankingRule,
|
2023-03-22 14:50:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut options = EnvOpenOptions::new();
|
|
|
|
options.map_size(100 * 1024 * 1024 * 1024); // 100 GB
|
|
|
|
|
2023-04-24 10:07:49 +02:00
|
|
|
let index = Index::new(options, "data_movies.ms").unwrap();
|
2023-03-22 14:50:41 +01:00
|
|
|
let mut wtxn = index.write_txn().unwrap();
|
|
|
|
|
|
|
|
let config = IndexerConfig::default();
|
|
|
|
let mut builder = Settings::new(&mut wtxn, &index, &config);
|
|
|
|
|
|
|
|
// builder.set_min_word_len_one_typo(5);
|
|
|
|
// builder.set_min_word_len_two_typos(7);
|
|
|
|
// builder.set_sortable_fields(hashset! { S("release_date") });
|
2023-11-08 10:45:06 +01:00
|
|
|
builder.set_ranking_rules(vec![
|
|
|
|
RankingRule::Words,
|
|
|
|
RankingRule::Typo,
|
|
|
|
RankingRule::Proximity,
|
|
|
|
RankingRule::Attribute,
|
|
|
|
RankingRule::Sort,
|
|
|
|
RankingRule::Exactness,
|
2023-03-22 14:50:41 +01:00
|
|
|
]);
|
|
|
|
|
|
|
|
builder.execute(|_| (), || false).unwrap();
|
|
|
|
wtxn.commit().unwrap();
|
|
|
|
}
|