mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
introduce exact attribute setting
This commit is contained in:
parent
c882d8daf0
commit
f82d4b36eb
2 changed files with 51 additions and 1 deletions
|
@ -53,6 +53,7 @@ pub mod main_key {
|
|||
pub const ONE_TYPO_WORD_LEN: &str = "one-typo-word-len";
|
||||
pub const TWO_TYPOS_WORD_LEN: &str = "two-typos-word-len";
|
||||
pub const EXACT_WORDS: &str = "exact-words";
|
||||
pub const EXACT_ATTRIBUTES: &str = "exact-attributes";
|
||||
}
|
||||
|
||||
pub mod db_name {
|
||||
|
@ -949,6 +950,23 @@ impl Index {
|
|||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn exact_attributes<'t>(&self, txn: &'t RoTxn) -> Result<Vec<&'t str>> {
|
||||
Ok(self
|
||||
.main
|
||||
.get::<_, Str, SerdeBincode<Vec<&str>>>(txn, main_key::EXACT_ATTRIBUTES)?
|
||||
.unwrap_or_default())
|
||||
}
|
||||
|
||||
pub(crate) fn put_exact_attributes(&self, txn: &mut RwTxn, attrs: &[&str]) -> Result<()> {
|
||||
self.main.put::<_, Str, SerdeBincode<&[&str]>>(txn, main_key::EXACT_ATTRIBUTES, &attrs)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn delete_exact_attributes(&self, txn: &mut RwTxn) -> Result<()> {
|
||||
self.main.delete::<_, Str>(txn, main_key::EXACT_ATTRIBUTES)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue