Introduce the primary key to the Settings builder structure

This commit is contained in:
Kerollmops 2021-06-15 13:45:20 +02:00
parent a7d6930905
commit 713acc408b
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
6 changed files with 121 additions and 23 deletions

View file

@ -55,15 +55,15 @@ pub fn base_setup(conf: &Conf) -> Index {
options.map_size(100 * 1024 * 1024 * 1024); // 100 GB
options.max_readers(10);
let index = Index::new(options, conf.database_name).unwrap();
if let Some(primary_key) = conf.primary_key {
let mut wtxn = index.write_txn().unwrap();
index.put_primary_key(&mut wtxn, primary_key).unwrap();
}
let update_builder = UpdateBuilder::new(0);
let mut wtxn = index.write_txn().unwrap();
let mut builder = update_builder.settings(&mut wtxn, &index);
if let Some(primary_key) = conf.primary_key {
builder.set_primary_key(primary_key.to_string());
}
if let Some(criterion) = conf.criterion {
builder.reset_filterable_fields();
builder.reset_criteria();