Add changes according to milli update

This commit is contained in:
Clémentine Urquizar 2021-06-03 19:36:25 +02:00
parent 1e659bb17b
commit aa04124bfc
No known key found for this signature in database
GPG key ID: D8E7CC7422E77E1A
7 changed files with 55 additions and 18 deletions

View file

@ -1,4 +1,4 @@
use std::collections::{BTreeSet, HashMap};
use std::collections::{BTreeSet, HashSet};
use std::io;
use std::marker::PhantomData;
use std::num::NonZeroUsize;
@ -51,7 +51,7 @@ pub struct Settings<T> {
deserialize_with = "deserialize_some",
skip_serializing_if = "Option::is_none"
)]
pub attributes_for_faceting: Option<Option<HashMap<String, String>>>,
pub attributes_for_faceting: Option<Option<HashSet<String>>>,
#[serde(
default,
@ -253,8 +253,8 @@ impl Index {
}
if let Some(ref facet_types) = settings.attributes_for_faceting {
let facet_types = facet_types.clone().unwrap_or_else(HashMap::new);
builder.set_faceted_fields(facet_types);
let facet_types = facet_types.clone().unwrap_or_else(HashSet::new);
builder.set_filterable_fields(facet_types);
}
if let Some(ref criteria) = settings.ranking_rules {
@ -273,8 +273,8 @@ impl Index {
if let Some(ref distinct_attribute) = settings.distinct_attribute {
match distinct_attribute {
Some(attr) => builder.set_distinct_attribute(attr.clone()),
None => builder.reset_distinct_attribute(),
Some(attr) => builder.set_distinct_field(attr.clone()),
None => builder.reset_distinct_field(),
}
}