mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
add exact attributes documentation
This commit is contained in:
parent
b85cd4983e
commit
5cfd3d8407
@ -964,6 +964,7 @@ impl Index {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the exact attributes: attributes for which typo is disallowed.
|
||||||
pub fn exact_attributes<'t>(&self, txn: &'t RoTxn) -> Result<Vec<&'t str>> {
|
pub fn exact_attributes<'t>(&self, txn: &'t RoTxn) -> Result<Vec<&'t str>> {
|
||||||
Ok(self
|
Ok(self
|
||||||
.main
|
.main
|
||||||
@ -971,17 +972,20 @@ impl Index {
|
|||||||
.unwrap_or_default())
|
.unwrap_or_default())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the list of exact attributes field ids.
|
||||||
pub fn exact_attributes_ids(&self, txn: &RoTxn) -> Result<HashSet<FieldId>> {
|
pub fn exact_attributes_ids(&self, txn: &RoTxn) -> Result<HashSet<FieldId>> {
|
||||||
let attrs = self.exact_attributes(txn)?;
|
let attrs = self.exact_attributes(txn)?;
|
||||||
let fid_map = self.fields_ids_map(txn)?;
|
let fid_map = self.fields_ids_map(txn)?;
|
||||||
Ok(attrs.iter().filter_map(|attr| fid_map.id(attr)).collect())
|
Ok(attrs.iter().filter_map(|attr| fid_map.id(attr)).collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Writes the exact attributes to the database.
|
||||||
pub(crate) fn put_exact_attributes(&self, txn: &mut RwTxn, attrs: &[&str]) -> Result<()> {
|
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)?;
|
self.main.put::<_, Str, SerdeBincode<&[&str]>>(txn, main_key::EXACT_ATTRIBUTES, &attrs)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Clears the exact attributes from the store.
|
||||||
pub(crate) fn delete_exact_attributes(&self, txn: &mut RwTxn) -> Result<()> {
|
pub(crate) fn delete_exact_attributes(&self, txn: &mut RwTxn) -> Result<()> {
|
||||||
self.main.delete::<_, Str>(txn, main_key::EXACT_ATTRIBUTES)?;
|
self.main.delete::<_, Str>(txn, main_key::EXACT_ATTRIBUTES)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user