extract exact word docids

This commit is contained in:
ad hoc 2022-03-24 17:00:29 +01:00
parent 5451c64d5d
commit 8d46a5b0b5
No known key found for this signature in database
GPG key ID: 4F00A782990CC643
5 changed files with 50 additions and 7 deletions

View file

@ -964,6 +964,11 @@ impl Index {
.get::<_, Str, SerdeBincode<Vec<&str>>>(txn, main_key::EXACT_ATTRIBUTES)?
.unwrap_or_default())
}
pub fn exact_attributes_ids(&self, txn: &RoTxn) -> Result<HashSet<FieldId>> {
let attrs = self.exact_attributes(txn)?;
let fid_map = self.fields_ids_map(txn)?;
Ok(attrs.iter().filter_map(|attr| fid_map.id(attr)).collect())
}
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)?;