mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-12-02 01:55:03 +08:00
Merge #4543
4543: Bring back changes from v1.7.4 into main r=Kerollmops a=dureuill Co-authored-by: Louis Dureuil <louis@meilisearch.com> Co-authored-by: meili-bors[bot] <89034592+meili-bors[bot]@users.noreply.github.com> Co-authored-by: dureuill <dureuill@users.noreply.github.com>
This commit is contained in:
commit
92a049c2dd
@ -1061,13 +1061,14 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
|
|||||||
{
|
{
|
||||||
self.index.set_updated_at(self.wtxn, &OffsetDateTime::now_utc())?;
|
self.index.set_updated_at(self.wtxn, &OffsetDateTime::now_utc())?;
|
||||||
|
|
||||||
|
// Note: this MUST be before `update_sortable` so that we can get the old value to compare with the updated value afterwards
|
||||||
|
|
||||||
let existing_fields: HashSet<_> = self
|
let existing_fields: HashSet<_> = self
|
||||||
.index
|
.index
|
||||||
.field_distribution(self.wtxn)?
|
.field_distribution(self.wtxn)?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|(field, count)| (count != 0).then_some(field))
|
.filter_map(|(field, count)| (count != 0).then_some(field))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let old_faceted_fields = self.index.user_defined_faceted_fields(self.wtxn)?;
|
let old_faceted_fields = self.index.user_defined_faceted_fields(self.wtxn)?;
|
||||||
let old_fields_ids_map = self.index.fields_ids_map(self.wtxn)?;
|
let old_fields_ids_map = self.index.fields_ids_map(self.wtxn)?;
|
||||||
|
|
||||||
@ -1084,13 +1085,7 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
|
|||||||
self.update_sort_facet_values_by()?;
|
self.update_sort_facet_values_by()?;
|
||||||
self.update_pagination_max_total_hits()?;
|
self.update_pagination_max_total_hits()?;
|
||||||
|
|
||||||
// If there is new faceted fields we indicate that we must reindex as we must
|
let faceted_updated = self.update_faceted(existing_fields, old_faceted_fields)?;
|
||||||
// index new fields as facets. It means that the distinct attribute,
|
|
||||||
// an Asc/Desc criterion or a filtered attribute as be added or removed.
|
|
||||||
let new_faceted_fields = self.index.user_defined_faceted_fields(self.wtxn)?;
|
|
||||||
let faceted_updated =
|
|
||||||
(&existing_fields - &old_faceted_fields) != (&existing_fields - &new_faceted_fields);
|
|
||||||
|
|
||||||
let stop_words_updated = self.update_stop_words()?;
|
let stop_words_updated = self.update_stop_words()?;
|
||||||
let non_separator_tokens_updated = self.update_non_separator_tokens()?;
|
let non_separator_tokens_updated = self.update_non_separator_tokens()?;
|
||||||
let separator_tokens_updated = self.update_separator_tokens()?;
|
let separator_tokens_updated = self.update_separator_tokens()?;
|
||||||
@ -1126,6 +1121,34 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn update_faceted(
|
||||||
|
&self,
|
||||||
|
existing_fields: HashSet<String>,
|
||||||
|
old_faceted_fields: HashSet<String>,
|
||||||
|
) -> Result<bool> {
|
||||||
|
if existing_fields.iter().any(|field| field.contains('.')) {
|
||||||
|
return Ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if old_faceted_fields.iter().any(|field| field.contains('.')) {
|
||||||
|
return Ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is new faceted fields we indicate that we must reindex as we must
|
||||||
|
// index new fields as facets. It means that the distinct attribute,
|
||||||
|
// an Asc/Desc criterion or a filtered attribute as be added or removed.
|
||||||
|
let new_faceted_fields = self.index.user_defined_faceted_fields(self.wtxn)?;
|
||||||
|
|
||||||
|
if new_faceted_fields.iter().any(|field| field.contains('.')) {
|
||||||
|
return Ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
let faceted_updated =
|
||||||
|
(&existing_fields - &old_faceted_fields) != (&existing_fields - &new_faceted_fields);
|
||||||
|
|
||||||
|
Ok(faceted_updated)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_prompt(
|
fn validate_prompt(
|
||||||
|
Loading…
Reference in New Issue
Block a user