mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Revert "Merge #1001"
This reverts commit690eab4a25
, reversing changes made to086020e543
. update changelog
This commit is contained in:
parent
39cf1931ae
commit
a8ab15d65d
8 changed files with 95 additions and 120 deletions
|
@ -246,7 +246,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_facet_key() {
|
||||
let mut schema = Schema::new();
|
||||
let id = schema.register_field("hello").unwrap();
|
||||
let id = schema.insert_and_index("hello").unwrap();
|
||||
let facet_list = [schema.id("hello").unwrap()];
|
||||
assert_eq!(
|
||||
FacetKey::from_str("hello:12", &schema, &facet_list).unwrap(),
|
||||
|
@ -287,7 +287,7 @@ mod test {
|
|||
fn test_parse_facet_array() {
|
||||
use either::Either::{Left, Right};
|
||||
let mut schema = Schema::new();
|
||||
let _id = schema.register_field("hello").unwrap();
|
||||
let _id = schema.insert_and_index("hello").unwrap();
|
||||
let facet_list = [schema.id("hello").unwrap()];
|
||||
assert_eq!(
|
||||
FacetFilter::from_str("[[\"hello:12\"]]", &schema, &facet_list).unwrap(),
|
||||
|
|
|
@ -55,7 +55,6 @@ pub struct Deserializer<'a> {
|
|||
pub documents_fields: DocumentsFields,
|
||||
pub schema: &'a Schema,
|
||||
pub fields: Option<&'a HashSet<FieldId>>,
|
||||
pub displayed: bool,
|
||||
}
|
||||
|
||||
impl<'de, 'a, 'b> de::Deserializer<'de> for &'b mut Deserializer<'a> {
|
||||
|
@ -94,9 +93,7 @@ impl<'de, 'a, 'b> de::Deserializer<'de> for &'b mut Deserializer<'a> {
|
|||
};
|
||||
|
||||
let is_displayed = self.schema.is_displayed(attr);
|
||||
// Check if displayed fields were requested, if yes, return only displayed fields,
|
||||
// else return all fields
|
||||
if !self.displayed || (is_displayed && self.fields.map_or(true, |f| f.contains(&attr))) {
|
||||
if is_displayed && self.fields.map_or(true, |f| f.contains(&attr)) {
|
||||
if let Some(attribute_name) = self.schema.name(attr) {
|
||||
let cursor = Cursor::new(value.to_owned());
|
||||
let ioread = SerdeJsonIoRead::new(cursor);
|
||||
|
|
|
@ -243,7 +243,6 @@ impl Index {
|
|||
documents_fields: self.documents_fields,
|
||||
schema: &schema,
|
||||
fields: attributes.as_ref(),
|
||||
displayed: true,
|
||||
};
|
||||
|
||||
Ok(Option::<T>::deserialize(&mut deserializer)?)
|
||||
|
|
|
@ -197,7 +197,6 @@ pub fn apply_addition<'a, 'b>(
|
|||
documents_fields: index.documents_fields,
|
||||
schema: &schema,
|
||||
fields: None,
|
||||
displayed: false,
|
||||
};
|
||||
|
||||
let old_document = Option::<HashMap<String, Value>>::deserialize(&mut deserializer)?;
|
||||
|
@ -229,7 +228,7 @@ pub fn apply_addition<'a, 'b>(
|
|||
for (document_id, document) in &documents_additions {
|
||||
// For each key-value pair in the document.
|
||||
for (attribute, value) in document {
|
||||
let field_id = schema.register_field(&attribute)?;
|
||||
let field_id = schema.insert_and_index(&attribute)?;
|
||||
index_document(
|
||||
writer,
|
||||
index.documents_fields,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue