mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Rename AttributesToSearchIn into SearchableAttributes; fix #428
This commit is contained in:
parent
110adcae85
commit
73918d803c
2 changed files with 13 additions and 13 deletions
|
@ -77,7 +77,7 @@ impl IndexSearchExt for Index {
|
|||
limit: 20,
|
||||
attributes_to_crop: None,
|
||||
attributes_to_retrieve: None,
|
||||
attributes_to_search_in: None,
|
||||
searchable_attributes: None,
|
||||
attributes_to_highlight: None,
|
||||
filters: None,
|
||||
timeout: Duration::from_millis(30),
|
||||
|
@ -93,7 +93,7 @@ pub struct SearchBuilder<'a> {
|
|||
limit: usize,
|
||||
attributes_to_crop: Option<HashMap<String, usize>>,
|
||||
attributes_to_retrieve: Option<HashSet<String>>,
|
||||
attributes_to_search_in: Option<HashSet<String>>,
|
||||
searchable_attributes: Option<HashSet<String>>,
|
||||
attributes_to_highlight: Option<HashSet<String>>,
|
||||
filters: Option<String>,
|
||||
timeout: Duration,
|
||||
|
@ -127,14 +127,14 @@ impl<'a> SearchBuilder<'a> {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn attributes_to_search_in(&mut self, value: HashSet<String>) -> &SearchBuilder {
|
||||
self.attributes_to_search_in = Some(value);
|
||||
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 attributes_to_search_in = self.attributes_to_search_in.get_or_insert(HashSet::new());
|
||||
attributes_to_search_in.insert(value);
|
||||
let searchable_attributes = self.searchable_attributes.get_or_insert(HashSet::new());
|
||||
searchable_attributes.insert(value);
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ impl<'a> SearchBuilder<'a> {
|
|||
};
|
||||
|
||||
// Filter searchable fields
|
||||
if let Some(fields) = &self.attributes_to_search_in {
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue