Remove SearchableAttributes; fix #429

This commit is contained in:
qdequele 2020-01-03 10:00:04 +01:00
parent 73918d803c
commit 203c83bdb4
No known key found for this signature in database
GPG key ID: B3F0A000EBF11745
2 changed files with 1 additions and 29 deletions

View file

@ -77,7 +77,6 @@ impl IndexSearchExt for Index {
limit: 20,
attributes_to_crop: None,
attributes_to_retrieve: None,
searchable_attributes: None,
attributes_to_highlight: None,
filters: None,
timeout: Duration::from_millis(30),
@ -93,7 +92,6 @@ pub struct SearchBuilder<'a> {
limit: usize,
attributes_to_crop: Option<HashMap<String, usize>>,
attributes_to_retrieve: Option<HashSet<String>>,
searchable_attributes: Option<HashSet<String>>,
attributes_to_highlight: Option<HashSet<String>>,
filters: Option<String>,
timeout: Duration,
@ -127,17 +125,6 @@ impl<'a> SearchBuilder<'a> {
self
}
pub fn searchable_attributes(&mut self, value: HashSet<String>) -> &SearchBuilder {
self.searchable_attributes = Some(value);
self
}
pub fn add_attribute_to_search_in(&mut self, value: String) -> &SearchBuilder {
let searchable_attributes = self.searchable_attributes.get_or_insert(HashSet::new());
searchable_attributes.insert(value);
self
}
pub fn attributes_to_highlight(&mut self, value: HashSet<String>) -> &SearchBuilder {
self.attributes_to_highlight = Some(value);
self
@ -176,13 +163,6 @@ impl<'a> SearchBuilder<'a> {
None => self.index.query_builder(),
};
// Filter searchable fields
if let Some(fields) = &self.searchable_attributes {
for attribute in fields.iter().filter_map(|f| schema.attribute(f)) {
query_builder.add_searchable_attribute(attribute.0);
}
}
if let Some(filters) = &self.filters {
let mut split = filters.split(':');
match (split.next(), split.next()) {