mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-25 06:00:08 +01:00
Clean up some comments and variable names
This commit is contained in:
parent
3026840530
commit
ae30ee2ade
@ -18,13 +18,13 @@ mod query_words_mapper;
|
|||||||
mod ranked_map;
|
mod ranked_map;
|
||||||
mod raw_document;
|
mod raw_document;
|
||||||
mod reordered_attrs;
|
mod reordered_attrs;
|
||||||
pub mod update;
|
|
||||||
pub mod criterion;
|
pub mod criterion;
|
||||||
pub mod facets;
|
pub mod facets;
|
||||||
pub mod raw_indexer;
|
pub mod raw_indexer;
|
||||||
pub mod settings;
|
|
||||||
pub mod serde;
|
pub mod serde;
|
||||||
|
pub mod settings;
|
||||||
pub mod store;
|
pub mod store;
|
||||||
|
pub mod update;
|
||||||
|
|
||||||
pub use self::database::{BoxUpdateFn, Database, DatabaseOptions, MainT, UpdateT};
|
pub use self::database::{BoxUpdateFn, Database, DatabaseOptions, MainT, UpdateT};
|
||||||
pub use self::error::{Error, HeedError, FstError, MResult, pest_error, FacetError};
|
pub use self::error::{Error, HeedError, FstError, MResult, pest_error, FacetError};
|
||||||
|
@ -13,8 +13,7 @@ use crate::database::{UpdateEvent, UpdateEventsEmitter};
|
|||||||
use crate::facets;
|
use crate::facets;
|
||||||
use crate::raw_indexer::RawIndexer;
|
use crate::raw_indexer::RawIndexer;
|
||||||
use crate::serde::Deserializer;
|
use crate::serde::Deserializer;
|
||||||
use crate::store::{DocumentsFields, DocumentsFieldsCounts};
|
use crate::store::{self, DocumentsFields, DocumentsFieldsCounts};
|
||||||
use crate::store;
|
|
||||||
use crate::update::helpers::{index_value, value_to_number, extract_document_id};
|
use crate::update::helpers::{index_value, value_to_number, extract_document_id};
|
||||||
use crate::update::{apply_documents_deletion, compute_short_prefixes, next_update_id, Update};
|
use crate::update::{apply_documents_deletion, compute_short_prefixes, next_update_id, Update};
|
||||||
use crate::{Error, MResult, RankedMap};
|
use crate::{Error, MResult, RankedMap};
|
||||||
@ -147,7 +146,7 @@ fn index_document(
|
|||||||
pub fn apply_addition<'a, 'b>(
|
pub fn apply_addition<'a, 'b>(
|
||||||
writer: &'a mut heed::RwTxn<'b, MainT>,
|
writer: &'a mut heed::RwTxn<'b, MainT>,
|
||||||
index: &store::Index,
|
index: &store::Index,
|
||||||
addition: Vec<IndexMap<String, Value>>,
|
new_documents: Vec<IndexMap<String, Value>>,
|
||||||
partial: bool
|
partial: bool
|
||||||
) -> MResult<()> {
|
) -> MResult<()> {
|
||||||
let mut documents_additions = HashMap::new();
|
let mut documents_additions = HashMap::new();
|
||||||
@ -160,7 +159,7 @@ pub fn apply_addition<'a, 'b>(
|
|||||||
let primary_key = schema.primary_key().ok_or(Error::MissingPrimaryKey)?;
|
let primary_key = schema.primary_key().ok_or(Error::MissingPrimaryKey)?;
|
||||||
|
|
||||||
// 1. store documents ids for future deletion
|
// 1. store documents ids for future deletion
|
||||||
for mut document in addition {
|
for mut document in new_documents {
|
||||||
let document_id = extract_document_id(&primary_key, &document)?;
|
let document_id = extract_document_id(&primary_key, &document)?;
|
||||||
|
|
||||||
if partial {
|
if partial {
|
||||||
@ -172,10 +171,8 @@ pub fn apply_addition<'a, 'b>(
|
|||||||
fields: None,
|
fields: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
// retrieve the old document and
|
let old_document = Option::<HashMap<String, Value>>::deserialize(&mut deserializer)?;
|
||||||
// update the new one with missing keys found in the old one
|
if let Some(old_document) = old_document {
|
||||||
let result = Option::<HashMap<String, Value>>::deserialize(&mut deserializer)?;
|
|
||||||
if let Some(old_document) = result {
|
|
||||||
for (key, value) in old_document {
|
for (key, value) in old_document {
|
||||||
document.entry(key).or_insert(value);
|
document.entry(key).or_insert(value);
|
||||||
}
|
}
|
||||||
@ -242,17 +239,17 @@ pub fn apply_addition<'a, 'b>(
|
|||||||
pub fn apply_documents_partial_addition<'a, 'b>(
|
pub fn apply_documents_partial_addition<'a, 'b>(
|
||||||
writer: &'a mut heed::RwTxn<'b, MainT>,
|
writer: &'a mut heed::RwTxn<'b, MainT>,
|
||||||
index: &store::Index,
|
index: &store::Index,
|
||||||
addition: Vec<IndexMap<String, Value>>,
|
new_documents: Vec<IndexMap<String, Value>>,
|
||||||
) -> MResult<()> {
|
) -> MResult<()> {
|
||||||
apply_addition(writer, index, addition, true)
|
apply_addition(writer, index, new_documents, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn apply_documents_addition<'a, 'b>(
|
pub fn apply_documents_addition<'a, 'b>(
|
||||||
writer: &'a mut heed::RwTxn<'b, MainT>,
|
writer: &'a mut heed::RwTxn<'b, MainT>,
|
||||||
index: &store::Index,
|
index: &store::Index,
|
||||||
addition: Vec<IndexMap<String, Value>>,
|
new_documents: Vec<IndexMap<String, Value>>,
|
||||||
) -> MResult<()> {
|
) -> MResult<()> {
|
||||||
apply_addition(writer, index, addition, false)
|
apply_addition(writer, index, new_documents, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reindex_all_documents(writer: &mut heed::RwTxn<MainT>, index: &store::Index) -> MResult<()> {
|
pub fn reindex_all_documents(writer: &mut heed::RwTxn<MainT>, index: &store::Index) -> MResult<()> {
|
||||||
|
@ -49,16 +49,16 @@ impl Update {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn documents_addition(data: Vec<IndexMap<String, Value>>) -> Update {
|
fn documents_addition(documents: Vec<IndexMap<String, Value>>) -> Update {
|
||||||
Update {
|
Update {
|
||||||
data: UpdateData::DocumentsAddition(data),
|
data: UpdateData::DocumentsAddition(documents),
|
||||||
enqueued_at: Utc::now(),
|
enqueued_at: Utc::now(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn documents_partial(data: Vec<IndexMap<String, Value>>) -> Update {
|
fn documents_partial(documents: Vec<IndexMap<String, Value>>) -> Update {
|
||||||
Update {
|
Update {
|
||||||
data: UpdateData::DocumentsPartial(data),
|
data: UpdateData::DocumentsPartial(documents),
|
||||||
enqueued_at: Utc::now(),
|
enqueued_at: Utc::now(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user