mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
Merge pull request #281 from meilisearch/fix-attributes-to-search-in
Take attributes to search in into account
This commit is contained in:
commit
3a6f3947c9
2 changed files with 7 additions and 1 deletions
|
@ -131,6 +131,12 @@ impl<'a> SearchBuilder<'a> {
|
||||||
self
|
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);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn attributes_to_highlight(&mut self, value: HashSet<String>) -> &SearchBuilder {
|
pub fn attributes_to_highlight(&mut self, value: HashSet<String>) -> &SearchBuilder {
|
||||||
self.attributes_to_highlight = Some(value);
|
self.attributes_to_highlight = Some(value);
|
||||||
self
|
self
|
||||||
|
|
|
@ -56,7 +56,7 @@ pub async fn search_with_url_query(ctx: Context<Data>) -> SResult<Response> {
|
||||||
}
|
}
|
||||||
if let Some(attributes_to_search_in) = query.attributes_to_search_in {
|
if let Some(attributes_to_search_in) = query.attributes_to_search_in {
|
||||||
for attr in attributes_to_search_in.split(',') {
|
for attr in attributes_to_search_in.split(',') {
|
||||||
search_builder.add_retrievable_field(attr.to_string());
|
search_builder.add_attribute_to_search_in(attr.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(attributes_to_crop) = query.attributes_to_crop {
|
if let Some(attributes_to_crop) = query.attributes_to_crop {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue