mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 21:20:24 +01:00
Introduce the word documents count method on the index
This commit is contained in:
parent
8d710c5130
commit
2f561c77f5
@ -352,6 +352,17 @@ impl Index {
|
||||
}
|
||||
}
|
||||
|
||||
/* word documents count */
|
||||
|
||||
/// Returns the number of documents ids associated with the given word,
|
||||
/// it is much faster than deserializing the bitmap and getting the length of it.
|
||||
pub fn word_documents_count(&self, rtxn: &RoTxn, word: &str) -> anyhow::Result<Option<u64>> {
|
||||
self.word_docids
|
||||
.remap_data_type::<RoaringBitmapLenCodec>()
|
||||
.get(rtxn, word)
|
||||
.map_err(Into::into)
|
||||
}
|
||||
|
||||
/* documents */
|
||||
|
||||
/// Returns a [`Vec`] of the requested documents. Returns an error if a document is missing.
|
||||
|
Loading…
x
Reference in New Issue
Block a user