mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
Rename the PrefixCache into PrefixDocumentsCache
This commit is contained in:
parent
1a5a104f13
commit
58836d89aa
8 changed files with 44 additions and 44 deletions
|
@ -1,5 +1,5 @@
|
|||
mod docs_words;
|
||||
mod prefix_cache;
|
||||
mod prefix_documents_cache;
|
||||
mod documents_fields;
|
||||
mod documents_fields_counts;
|
||||
mod main;
|
||||
|
@ -9,7 +9,7 @@ mod updates;
|
|||
mod updates_results;
|
||||
|
||||
pub use self::docs_words::DocsWords;
|
||||
pub use self::prefix_cache::PrefixCache;
|
||||
pub use self::prefix_documents_cache::PrefixDocumentsCache;
|
||||
pub use self::documents_fields::{DocumentFieldsIter, DocumentsFields};
|
||||
pub use self::documents_fields_counts::{
|
||||
DocumentFieldsCountsIter, DocumentsFieldsCounts, DocumentsIdsIter,
|
||||
|
@ -76,7 +76,7 @@ fn docs_words_name(name: &str) -> String {
|
|||
format!("store-{}-docs-words", name)
|
||||
}
|
||||
|
||||
fn prefix_cache_name(name: &str) -> String {
|
||||
fn prefix_documents_cache_name(name: &str) -> String {
|
||||
format!("store-{}-prefix-cache", name)
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ pub struct Index {
|
|||
pub documents_fields_counts: DocumentsFieldsCounts,
|
||||
pub synonyms: Synonyms,
|
||||
pub docs_words: DocsWords,
|
||||
pub prefix_cache: PrefixCache,
|
||||
pub prefix_documents_cache: PrefixDocumentsCache,
|
||||
|
||||
pub updates: Updates,
|
||||
pub updates_results: UpdatesResults,
|
||||
|
@ -259,7 +259,7 @@ impl Index {
|
|||
self.postings_lists,
|
||||
self.documents_fields_counts,
|
||||
self.synonyms,
|
||||
self.prefix_cache,
|
||||
self.prefix_documents_cache,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ impl Index {
|
|||
self.postings_lists,
|
||||
self.documents_fields_counts,
|
||||
self.synonyms,
|
||||
self.prefix_cache,
|
||||
self.prefix_documents_cache,
|
||||
criteria,
|
||||
)
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ pub fn create(
|
|||
let documents_fields_counts_name = documents_fields_counts_name(name);
|
||||
let synonyms_name = synonyms_name(name);
|
||||
let docs_words_name = docs_words_name(name);
|
||||
let prefix_cache_name = prefix_cache_name(name);
|
||||
let prefix_documents_cache_name = prefix_documents_cache_name(name);
|
||||
let updates_name = updates_name(name);
|
||||
let updates_results_name = updates_results_name(name);
|
||||
|
||||
|
@ -302,7 +302,7 @@ pub fn create(
|
|||
let documents_fields_counts = env.create_database(Some(&documents_fields_counts_name))?;
|
||||
let synonyms = env.create_database(Some(&synonyms_name))?;
|
||||
let docs_words = env.create_database(Some(&docs_words_name))?;
|
||||
let prefix_cache = env.create_database(Some(&prefix_cache_name))?;
|
||||
let prefix_documents_cache = env.create_database(Some(&prefix_documents_cache_name))?;
|
||||
let updates = update_env.create_database(Some(&updates_name))?;
|
||||
let updates_results = update_env.create_database(Some(&updates_results_name))?;
|
||||
|
||||
|
@ -315,7 +315,7 @@ pub fn create(
|
|||
},
|
||||
synonyms: Synonyms { synonyms },
|
||||
docs_words: DocsWords { docs_words },
|
||||
prefix_cache: PrefixCache { prefix_cache },
|
||||
prefix_documents_cache: PrefixDocumentsCache { prefix_documents_cache },
|
||||
updates: Updates { updates },
|
||||
updates_results: UpdatesResults { updates_results },
|
||||
updates_notifier,
|
||||
|
@ -335,7 +335,7 @@ pub fn open(
|
|||
let documents_fields_counts_name = documents_fields_counts_name(name);
|
||||
let synonyms_name = synonyms_name(name);
|
||||
let docs_words_name = docs_words_name(name);
|
||||
let prefix_cache_name = prefix_cache_name(name);
|
||||
let prefix_documents_cache_name = prefix_documents_cache_name(name);
|
||||
let updates_name = updates_name(name);
|
||||
let updates_results_name = updates_results_name(name);
|
||||
|
||||
|
@ -364,8 +364,8 @@ pub fn open(
|
|||
Some(docs_words) => docs_words,
|
||||
None => return Ok(None),
|
||||
};
|
||||
let prefix_cache = match env.open_database(Some(&prefix_cache_name))? {
|
||||
Some(prefix_cache) => prefix_cache,
|
||||
let prefix_documents_cache = match env.open_database(Some(&prefix_documents_cache_name))? {
|
||||
Some(prefix_documents_cache) => prefix_documents_cache,
|
||||
None => return Ok(None),
|
||||
};
|
||||
let updates = match update_env.open_database(Some(&updates_name))? {
|
||||
|
@ -386,7 +386,7 @@ pub fn open(
|
|||
},
|
||||
synonyms: Synonyms { synonyms },
|
||||
docs_words: DocsWords { docs_words },
|
||||
prefix_cache: PrefixCache { prefix_cache },
|
||||
prefix_documents_cache: PrefixDocumentsCache { prefix_documents_cache },
|
||||
updates: Updates { updates },
|
||||
updates_results: UpdatesResults { updates_results },
|
||||
updates_notifier,
|
||||
|
@ -405,7 +405,7 @@ pub fn clear(
|
|||
index.documents_fields_counts.clear(writer)?;
|
||||
index.synonyms.clear(writer)?;
|
||||
index.docs_words.clear(writer)?;
|
||||
index.prefix_cache.clear(writer)?;
|
||||
index.prefix_documents_cache.clear(writer)?;
|
||||
index.updates.clear(update_writer)?;
|
||||
index.updates_results.clear(update_writer)?;
|
||||
Ok(())
|
||||
|
|
|
@ -27,11 +27,11 @@ impl PrefixKey {
|
|||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct PrefixCache {
|
||||
pub(crate) prefix_cache: heed::Database<OwnedType<PrefixKey>, CowSlice<Highlight>>,
|
||||
pub struct PrefixDocumentsCache {
|
||||
pub(crate) prefix_documents_cache: heed::Database<OwnedType<PrefixKey>, CowSlice<Highlight>>,
|
||||
}
|
||||
|
||||
impl PrefixCache {
|
||||
impl PrefixDocumentsCache {
|
||||
pub fn put_prefix_document(
|
||||
self,
|
||||
writer: &mut heed::RwTxn<MainT>,
|
||||
|
@ -41,11 +41,11 @@ impl PrefixCache {
|
|||
highlights: &[Highlight],
|
||||
) -> ZResult<()> {
|
||||
let key = PrefixKey::new(prefix, index as u64, docid.0);
|
||||
self.prefix_cache.put(writer, &key, highlights)
|
||||
self.prefix_documents_cache.put(writer, &key, highlights)
|
||||
}
|
||||
|
||||
pub fn clear(self, writer: &mut heed::RwTxn<MainT>) -> ZResult<()> {
|
||||
self.prefix_cache.clear(writer)
|
||||
self.prefix_documents_cache.clear(writer)
|
||||
}
|
||||
|
||||
pub fn prefix_documents<'txn>(
|
||||
|
@ -55,7 +55,7 @@ impl PrefixCache {
|
|||
) -> ZResult<PrefixDocumentsIter<'txn>> {
|
||||
let start = PrefixKey::new(prefix, 0, 0);
|
||||
let end = PrefixKey::new(prefix, u64::max_value(), u64::max_value());
|
||||
let iter = self.prefix_cache.range(reader, &(start..=end))?;
|
||||
let iter = self.prefix_documents_cache.range(reader, &(start..=end))?;
|
||||
Ok(PrefixDocumentsIter { iter })
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue