mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
rename the other parameter of the aggregate method to new to avoid confusion
This commit is contained in:
parent
c94679bde6
commit
73b5722896
@ -89,7 +89,7 @@ pub trait Aggregate: 'static + mopa::Any + Send {
|
|||||||
fn event_name(&self) -> &'static str;
|
fn event_name(&self) -> &'static str;
|
||||||
|
|
||||||
/// Will be called every time an event has been used twice before segment flushed its buffer.
|
/// Will be called every time an event has been used twice before segment flushed its buffer.
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self>
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self>
|
||||||
where
|
where
|
||||||
Self: Sized;
|
Self: Sized;
|
||||||
|
|
||||||
@ -97,16 +97,16 @@ pub trait Aggregate: 'static + mopa::Any + Send {
|
|||||||
/// This function should always be called on the same type. If `this` and `other`
|
/// This function should always be called on the same type. If `this` and `other`
|
||||||
/// aren't the same type behind the function will do nothing and return `None`.
|
/// aren't the same type behind the function will do nothing and return `None`.
|
||||||
fn downcast_aggregate(
|
fn downcast_aggregate(
|
||||||
this: Box<dyn Aggregate>,
|
old: Box<dyn Aggregate>,
|
||||||
other: Box<dyn Aggregate>,
|
new: Box<dyn Aggregate>,
|
||||||
) -> Option<Box<dyn Aggregate>>
|
) -> Option<Box<dyn Aggregate>>
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
if this.is::<Self>() && other.is::<Self>() {
|
if old.is::<Self>() && new.is::<Self>() {
|
||||||
// Both the two following lines cannot fail, but just to be sure we don't crash, we're still avoiding unwrapping
|
// Both the two following lines cannot fail, but just to be sure we don't crash, we're still avoiding unwrapping
|
||||||
let this = this.downcast::<Self>().ok()?;
|
let this = old.downcast::<Self>().ok()?;
|
||||||
let other = other.downcast::<Self>().ok()?;
|
let other = new.downcast::<Self>().ok()?;
|
||||||
Some(Self::aggregate(this, other))
|
Some(Self::aggregate(this, other))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -702,7 +702,7 @@ impl<Method: AggregateMethod> Aggregate for SearchAggregator<Method> {
|
|||||||
Method::event_name()
|
Method::event_name()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(mut self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(mut self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
let Self {
|
let Self {
|
||||||
total_received,
|
total_received,
|
||||||
total_succeeded,
|
total_succeeded,
|
||||||
@ -743,7 +743,7 @@ impl<Method: AggregateMethod> Aggregate for SearchAggregator<Method> {
|
|||||||
ranking_score_threshold,
|
ranking_score_threshold,
|
||||||
mut locales,
|
mut locales,
|
||||||
marker: _,
|
marker: _,
|
||||||
} = *other;
|
} = *new;
|
||||||
|
|
||||||
// request
|
// request
|
||||||
self.total_received = self.total_received.saturating_add(total_received);
|
self.total_received = self.total_received.saturating_add(total_received);
|
||||||
@ -1038,22 +1038,22 @@ impl Aggregate for MultiSearchAggregator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Aggregate one [MultiSearchAggregator] into another.
|
/// Aggregate one [MultiSearchAggregator] into another.
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
// write the aggregate in a way that will cause a compilation error if a field is added.
|
// write the aggregate in a way that will cause a compilation error if a field is added.
|
||||||
|
|
||||||
// get ownership of self, replacing it by a default value.
|
// get ownership of self, replacing it by a default value.
|
||||||
let this = *self;
|
let this = *self;
|
||||||
|
|
||||||
let total_received = this.total_received.saturating_add(other.total_received);
|
let total_received = this.total_received.saturating_add(new.total_received);
|
||||||
let total_succeeded = this.total_succeeded.saturating_add(other.total_succeeded);
|
let total_succeeded = this.total_succeeded.saturating_add(new.total_succeeded);
|
||||||
let total_distinct_index_count =
|
let total_distinct_index_count =
|
||||||
this.total_distinct_index_count.saturating_add(other.total_distinct_index_count);
|
this.total_distinct_index_count.saturating_add(new.total_distinct_index_count);
|
||||||
let total_single_index = this.total_single_index.saturating_add(other.total_single_index);
|
let total_single_index = this.total_single_index.saturating_add(new.total_single_index);
|
||||||
let total_search_count = this.total_search_count.saturating_add(other.total_search_count);
|
let total_search_count = this.total_search_count.saturating_add(new.total_search_count);
|
||||||
let show_ranking_score = this.show_ranking_score || other.show_ranking_score;
|
let show_ranking_score = this.show_ranking_score || new.show_ranking_score;
|
||||||
let show_ranking_score_details =
|
let show_ranking_score_details =
|
||||||
this.show_ranking_score_details || other.show_ranking_score_details;
|
this.show_ranking_score_details || new.show_ranking_score_details;
|
||||||
let use_federation = this.use_federation || other.use_federation;
|
let use_federation = this.use_federation || new.use_federation;
|
||||||
|
|
||||||
Box::new(Self {
|
Box::new(Self {
|
||||||
total_received,
|
total_received,
|
||||||
@ -1215,7 +1215,7 @@ impl<Method: AggregateMethod> Aggregate for SimilarAggregator<Method> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Aggregate one [SimilarAggregator] into another.
|
/// Aggregate one [SimilarAggregator] into another.
|
||||||
fn aggregate(mut self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(mut self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
let Self {
|
let Self {
|
||||||
total_received,
|
total_received,
|
||||||
total_succeeded,
|
total_succeeded,
|
||||||
@ -1233,7 +1233,7 @@ impl<Method: AggregateMethod> Aggregate for SimilarAggregator<Method> {
|
|||||||
ranking_score_threshold,
|
ranking_score_threshold,
|
||||||
retrieve_vectors,
|
retrieve_vectors,
|
||||||
marker: _,
|
marker: _,
|
||||||
} = *other;
|
} = *new;
|
||||||
|
|
||||||
// request
|
// request
|
||||||
self.total_received = self.total_received.saturating_add(total_received);
|
self.total_received = self.total_received.saturating_add(total_received);
|
||||||
|
@ -64,13 +64,13 @@ impl Aggregate for PatchExperimentalFeatureAnalytics {
|
|||||||
"Experimental features Updated"
|
"Experimental features Updated"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
Box::new(Self {
|
Box::new(Self {
|
||||||
vector_store: other.vector_store,
|
vector_store: new.vector_store,
|
||||||
metrics: other.metrics,
|
metrics: new.metrics,
|
||||||
logs_route: other.logs_route,
|
logs_route: new.logs_route,
|
||||||
edit_documents_by_function: other.edit_documents_by_function,
|
edit_documents_by_function: new.edit_documents_by_function,
|
||||||
contains_filter: other.contains_filter,
|
contains_filter: new.contains_filter,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,13 +158,13 @@ impl<Method: AggregateMethod> Aggregate for DocumentsFetchAggregator<Method> {
|
|||||||
Method::event_name()
|
Method::event_name()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
Box::new(Self {
|
Box::new(Self {
|
||||||
per_document_id: self.per_document_id | other.per_document_id,
|
per_document_id: self.per_document_id | new.per_document_id,
|
||||||
per_filter: self.per_filter | other.per_filter,
|
per_filter: self.per_filter | new.per_filter,
|
||||||
retrieve_vectors: self.retrieve_vectors | other.retrieve_vectors,
|
retrieve_vectors: self.retrieve_vectors | new.retrieve_vectors,
|
||||||
max_limit: self.max_limit.max(other.max_limit),
|
max_limit: self.max_limit.max(new.max_limit),
|
||||||
max_offset: self.max_offset.max(other.max_offset),
|
max_offset: self.max_offset.max(new.max_offset),
|
||||||
marker: PhantomData,
|
marker: PhantomData,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -223,12 +223,12 @@ impl Aggregate for DocumentsDeletionAggregator {
|
|||||||
"Documents Deleted"
|
"Documents Deleted"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
Box::new(Self {
|
Box::new(Self {
|
||||||
per_document_id: self.per_document_id | other.per_document_id,
|
per_document_id: self.per_document_id | new.per_document_id,
|
||||||
clear_all: self.clear_all | other.clear_all,
|
clear_all: self.clear_all | new.clear_all,
|
||||||
per_batch: self.per_batch | other.per_batch,
|
per_batch: self.per_batch | new.per_batch,
|
||||||
per_filter: self.per_filter | other.per_filter,
|
per_filter: self.per_filter | new.per_filter,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,11 +437,11 @@ impl<Method: AggregateMethod> Aggregate for DocumentsAggregator<Method> {
|
|||||||
Method::event_name()
|
Method::event_name()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
Box::new(Self {
|
Box::new(Self {
|
||||||
payload_types: self.payload_types.union(&other.payload_types).cloned().collect(),
|
payload_types: self.payload_types.union(&new.payload_types).cloned().collect(),
|
||||||
primary_key: self.primary_key.union(&other.primary_key).cloned().collect(),
|
primary_key: self.primary_key.union(&new.primary_key).cloned().collect(),
|
||||||
index_creation: self.index_creation | other.index_creation,
|
index_creation: self.index_creation | new.index_creation,
|
||||||
method: PhantomData,
|
method: PhantomData,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -815,11 +815,11 @@ impl Aggregate for EditDocumentsByFunctionAggregator {
|
|||||||
"Documents Edited By Function"
|
"Documents Edited By Function"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
Box::new(Self {
|
Box::new(Self {
|
||||||
filtered: self.filtered | other.filtered,
|
filtered: self.filtered | new.filtered,
|
||||||
with_context: self.with_context | other.with_context,
|
with_context: self.with_context | new.with_context,
|
||||||
index_creation: self.index_creation | other.index_creation,
|
index_creation: self.index_creation | new.index_creation,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,18 +113,18 @@ impl Aggregate for FacetSearchAggregator {
|
|||||||
"Facet Searched POST"
|
"Facet Searched POST"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(mut self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(mut self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
for time in other.time_spent {
|
for time in new.time_spent {
|
||||||
self.time_spent.push(time);
|
self.time_spent.push(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
Box::new(Self {
|
Box::new(Self {
|
||||||
total_received: self.total_received.saturating_add(other.total_received),
|
total_received: self.total_received.saturating_add(new.total_received),
|
||||||
total_succeeded: self.total_succeeded.saturating_add(other.total_succeeded),
|
total_succeeded: self.total_succeeded.saturating_add(new.total_succeeded),
|
||||||
time_spent: self.time_spent,
|
time_spent: self.time_spent,
|
||||||
facet_names: self.facet_names.union(&other.facet_names).cloned().collect(),
|
facet_names: self.facet_names.union(&new.facet_names).cloned().collect(),
|
||||||
additional_search_parameters_provided: self.additional_search_parameters_provided
|
additional_search_parameters_provided: self.additional_search_parameters_provided
|
||||||
| other.additional_search_parameters_provided,
|
| new.additional_search_parameters_provided,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,10 +134,8 @@ impl Aggregate for IndexCreatedAggregate {
|
|||||||
"Index Created"
|
"Index Created"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
Box::new(Self {
|
Box::new(Self { primary_key: self.primary_key.union(&new.primary_key).cloned().collect() })
|
||||||
primary_key: self.primary_key.union(&other.primary_key).cloned().collect(),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn into_event(self: Box<Self>) -> serde_json::Value {
|
fn into_event(self: Box<Self>) -> serde_json::Value {
|
||||||
@ -225,10 +223,8 @@ impl Aggregate for IndexUpdatedAggregate {
|
|||||||
"Index Updated"
|
"Index Updated"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
Box::new(Self {
|
Box::new(Self { primary_key: self.primary_key.union(&new.primary_key).cloned().collect() })
|
||||||
primary_key: self.primary_key.union(&other.primary_key).cloned().collect(),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn into_event(self: Box<Self>) -> serde_json::Value {
|
fn into_event(self: Box<Self>) -> serde_json::Value {
|
||||||
|
@ -42,114 +42,108 @@ impl Aggregate for SettingsAnalytics {
|
|||||||
"Settings Updated"
|
"Settings Updated"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
Box::new(Self {
|
Box::new(Self {
|
||||||
ranking_rules: RankingRulesAnalytics {
|
ranking_rules: RankingRulesAnalytics {
|
||||||
words_position: self
|
words_position: self
|
||||||
.ranking_rules
|
.ranking_rules
|
||||||
.words_position
|
.words_position
|
||||||
.or(other.ranking_rules.words_position),
|
.or(new.ranking_rules.words_position),
|
||||||
typo_position: self
|
typo_position: self.ranking_rules.typo_position.or(new.ranking_rules.typo_position),
|
||||||
.ranking_rules
|
|
||||||
.typo_position
|
|
||||||
.or(other.ranking_rules.typo_position),
|
|
||||||
proximity_position: self
|
proximity_position: self
|
||||||
.ranking_rules
|
.ranking_rules
|
||||||
.proximity_position
|
.proximity_position
|
||||||
.or(other.ranking_rules.proximity_position),
|
.or(new.ranking_rules.proximity_position),
|
||||||
attribute_position: self
|
attribute_position: self
|
||||||
.ranking_rules
|
.ranking_rules
|
||||||
.attribute_position
|
.attribute_position
|
||||||
.or(other.ranking_rules.attribute_position),
|
.or(new.ranking_rules.attribute_position),
|
||||||
sort_position: self
|
sort_position: self.ranking_rules.sort_position.or(new.ranking_rules.sort_position),
|
||||||
.ranking_rules
|
|
||||||
.sort_position
|
|
||||||
.or(other.ranking_rules.sort_position),
|
|
||||||
exactness_position: self
|
exactness_position: self
|
||||||
.ranking_rules
|
.ranking_rules
|
||||||
.exactness_position
|
.exactness_position
|
||||||
.or(other.ranking_rules.exactness_position),
|
.or(new.ranking_rules.exactness_position),
|
||||||
values: self.ranking_rules.values.or(other.ranking_rules.values),
|
values: self.ranking_rules.values.or(new.ranking_rules.values),
|
||||||
},
|
},
|
||||||
searchable_attributes: SearchableAttributesAnalytics {
|
searchable_attributes: SearchableAttributesAnalytics {
|
||||||
total: self.searchable_attributes.total.or(other.searchable_attributes.total),
|
total: self.searchable_attributes.total.or(new.searchable_attributes.total),
|
||||||
with_wildcard: self
|
with_wildcard: self
|
||||||
.searchable_attributes
|
.searchable_attributes
|
||||||
.with_wildcard
|
.with_wildcard
|
||||||
.or(other.searchable_attributes.with_wildcard),
|
.or(new.searchable_attributes.with_wildcard),
|
||||||
},
|
},
|
||||||
displayed_attributes: DisplayedAttributesAnalytics {
|
displayed_attributes: DisplayedAttributesAnalytics {
|
||||||
total: self.displayed_attributes.total.or(other.displayed_attributes.total),
|
total: self.displayed_attributes.total.or(new.displayed_attributes.total),
|
||||||
with_wildcard: self
|
with_wildcard: self
|
||||||
.displayed_attributes
|
.displayed_attributes
|
||||||
.with_wildcard
|
.with_wildcard
|
||||||
.or(other.displayed_attributes.with_wildcard),
|
.or(new.displayed_attributes.with_wildcard),
|
||||||
},
|
},
|
||||||
sortable_attributes: SortableAttributesAnalytics {
|
sortable_attributes: SortableAttributesAnalytics {
|
||||||
total: self.sortable_attributes.total.or(other.sortable_attributes.total),
|
total: self.sortable_attributes.total.or(new.sortable_attributes.total),
|
||||||
has_geo: self.sortable_attributes.has_geo.or(other.sortable_attributes.has_geo),
|
has_geo: self.sortable_attributes.has_geo.or(new.sortable_attributes.has_geo),
|
||||||
},
|
},
|
||||||
filterable_attributes: FilterableAttributesAnalytics {
|
filterable_attributes: FilterableAttributesAnalytics {
|
||||||
total: self.filterable_attributes.total.or(other.filterable_attributes.total),
|
total: self.filterable_attributes.total.or(new.filterable_attributes.total),
|
||||||
has_geo: self.filterable_attributes.has_geo.or(other.filterable_attributes.has_geo),
|
has_geo: self.filterable_attributes.has_geo.or(new.filterable_attributes.has_geo),
|
||||||
},
|
},
|
||||||
distinct_attribute: DistinctAttributeAnalytics {
|
distinct_attribute: DistinctAttributeAnalytics {
|
||||||
set: self.distinct_attribute.set | other.distinct_attribute.set,
|
set: self.distinct_attribute.set | new.distinct_attribute.set,
|
||||||
},
|
},
|
||||||
proximity_precision: ProximityPrecisionAnalytics {
|
proximity_precision: ProximityPrecisionAnalytics {
|
||||||
set: self.proximity_precision.set | other.proximity_precision.set,
|
set: self.proximity_precision.set | new.proximity_precision.set,
|
||||||
value: self.proximity_precision.value.or(other.proximity_precision.value),
|
value: self.proximity_precision.value.or(new.proximity_precision.value),
|
||||||
},
|
},
|
||||||
typo_tolerance: TypoToleranceAnalytics {
|
typo_tolerance: TypoToleranceAnalytics {
|
||||||
enabled: self.typo_tolerance.enabled.or(other.typo_tolerance.enabled),
|
enabled: self.typo_tolerance.enabled.or(new.typo_tolerance.enabled),
|
||||||
disable_on_attributes: self
|
disable_on_attributes: self
|
||||||
.typo_tolerance
|
.typo_tolerance
|
||||||
.disable_on_attributes
|
.disable_on_attributes
|
||||||
.or(other.typo_tolerance.disable_on_attributes),
|
.or(new.typo_tolerance.disable_on_attributes),
|
||||||
disable_on_words: self
|
disable_on_words: self
|
||||||
.typo_tolerance
|
.typo_tolerance
|
||||||
.disable_on_words
|
.disable_on_words
|
||||||
.or(other.typo_tolerance.disable_on_words),
|
.or(new.typo_tolerance.disable_on_words),
|
||||||
min_word_size_for_one_typo: self
|
min_word_size_for_one_typo: self
|
||||||
.typo_tolerance
|
.typo_tolerance
|
||||||
.min_word_size_for_one_typo
|
.min_word_size_for_one_typo
|
||||||
.or(other.typo_tolerance.min_word_size_for_one_typo),
|
.or(new.typo_tolerance.min_word_size_for_one_typo),
|
||||||
min_word_size_for_two_typos: self
|
min_word_size_for_two_typos: self
|
||||||
.typo_tolerance
|
.typo_tolerance
|
||||||
.min_word_size_for_two_typos
|
.min_word_size_for_two_typos
|
||||||
.or(other.typo_tolerance.min_word_size_for_two_typos),
|
.or(new.typo_tolerance.min_word_size_for_two_typos),
|
||||||
},
|
},
|
||||||
faceting: FacetingAnalytics {
|
faceting: FacetingAnalytics {
|
||||||
max_values_per_facet: self
|
max_values_per_facet: self
|
||||||
.faceting
|
.faceting
|
||||||
.max_values_per_facet
|
.max_values_per_facet
|
||||||
.or(other.faceting.max_values_per_facet),
|
.or(new.faceting.max_values_per_facet),
|
||||||
sort_facet_values_by_star_count: self
|
sort_facet_values_by_star_count: self
|
||||||
.faceting
|
.faceting
|
||||||
.sort_facet_values_by_star_count
|
.sort_facet_values_by_star_count
|
||||||
.or(other.faceting.sort_facet_values_by_star_count),
|
.or(new.faceting.sort_facet_values_by_star_count),
|
||||||
sort_facet_values_by_total: self
|
sort_facet_values_by_total: self
|
||||||
.faceting
|
.faceting
|
||||||
.sort_facet_values_by_total
|
.sort_facet_values_by_total
|
||||||
.or(other.faceting.sort_facet_values_by_total),
|
.or(new.faceting.sort_facet_values_by_total),
|
||||||
},
|
},
|
||||||
pagination: PaginationAnalytics {
|
pagination: PaginationAnalytics {
|
||||||
max_total_hits: self.pagination.max_total_hits.or(other.pagination.max_total_hits),
|
max_total_hits: self.pagination.max_total_hits.or(new.pagination.max_total_hits),
|
||||||
},
|
},
|
||||||
stop_words: StopWordsAnalytics {
|
stop_words: StopWordsAnalytics {
|
||||||
total: self.stop_words.total.or(other.stop_words.total),
|
total: self.stop_words.total.or(new.stop_words.total),
|
||||||
},
|
},
|
||||||
synonyms: SynonymsAnalytics { total: self.synonyms.total.or(other.synonyms.total) },
|
synonyms: SynonymsAnalytics { total: self.synonyms.total.or(new.synonyms.total) },
|
||||||
embedders: EmbeddersAnalytics {
|
embedders: EmbeddersAnalytics {
|
||||||
total: self.embedders.total.or(other.embedders.total),
|
total: self.embedders.total.or(new.embedders.total),
|
||||||
sources: match (self.embedders.sources, other.embedders.sources) {
|
sources: match (self.embedders.sources, new.embedders.sources) {
|
||||||
(None, None) => None,
|
(None, None) => None,
|
||||||
(Some(sources), None) | (None, Some(sources)) => Some(sources),
|
(Some(sources), None) | (None, Some(sources)) => Some(sources),
|
||||||
(Some(this), Some(other)) => Some(this.union(&other).cloned().collect()),
|
(Some(this), Some(other)) => Some(this.union(&other).cloned().collect()),
|
||||||
},
|
},
|
||||||
document_template_used: match (
|
document_template_used: match (
|
||||||
self.embedders.document_template_used,
|
self.embedders.document_template_used,
|
||||||
other.embedders.document_template_used,
|
new.embedders.document_template_used,
|
||||||
) {
|
) {
|
||||||
(None, None) => None,
|
(None, None) => None,
|
||||||
(Some(used), None) | (None, Some(used)) => Some(used),
|
(Some(used), None) | (None, Some(used)) => Some(used),
|
||||||
@ -157,7 +151,7 @@ impl Aggregate for SettingsAnalytics {
|
|||||||
},
|
},
|
||||||
document_template_max_bytes: match (
|
document_template_max_bytes: match (
|
||||||
self.embedders.document_template_max_bytes,
|
self.embedders.document_template_max_bytes,
|
||||||
other.embedders.document_template_max_bytes,
|
new.embedders.document_template_max_bytes,
|
||||||
) {
|
) {
|
||||||
(None, None) => None,
|
(None, None) => None,
|
||||||
(Some(bytes), None) | (None, Some(bytes)) => Some(bytes),
|
(Some(bytes), None) | (None, Some(bytes)) => Some(bytes),
|
||||||
@ -165,7 +159,7 @@ impl Aggregate for SettingsAnalytics {
|
|||||||
},
|
},
|
||||||
binary_quantization_used: match (
|
binary_quantization_used: match (
|
||||||
self.embedders.binary_quantization_used,
|
self.embedders.binary_quantization_used,
|
||||||
other.embedders.binary_quantization_used,
|
new.embedders.binary_quantization_used,
|
||||||
) {
|
) {
|
||||||
(None, None) => None,
|
(None, None) => None,
|
||||||
(Some(bq), None) | (None, Some(bq)) => Some(bq),
|
(Some(bq), None) | (None, Some(bq)) => Some(bq),
|
||||||
@ -176,17 +170,17 @@ impl Aggregate for SettingsAnalytics {
|
|||||||
search_cutoff_ms: self
|
search_cutoff_ms: self
|
||||||
.search_cutoff_ms
|
.search_cutoff_ms
|
||||||
.search_cutoff_ms
|
.search_cutoff_ms
|
||||||
.or(other.search_cutoff_ms.search_cutoff_ms),
|
.or(new.search_cutoff_ms.search_cutoff_ms),
|
||||||
},
|
},
|
||||||
locales: LocalesAnalytics { locales: self.locales.locales.or(other.locales.locales) },
|
locales: LocalesAnalytics { locales: self.locales.locales.or(new.locales.locales) },
|
||||||
dictionary: DictionaryAnalytics {
|
dictionary: DictionaryAnalytics {
|
||||||
total: self.dictionary.total.or(other.dictionary.total),
|
total: self.dictionary.total.or(new.dictionary.total),
|
||||||
},
|
},
|
||||||
separator_tokens: SeparatorTokensAnalytics {
|
separator_tokens: SeparatorTokensAnalytics {
|
||||||
total: self.separator_tokens.total.or(other.non_separator_tokens.total),
|
total: self.separator_tokens.total.or(new.non_separator_tokens.total),
|
||||||
},
|
},
|
||||||
non_separator_tokens: NonSeparatorTokensAnalytics {
|
non_separator_tokens: NonSeparatorTokensAnalytics {
|
||||||
total: self.non_separator_tokens.total.or(other.non_separator_tokens.total),
|
total: self.non_separator_tokens.total.or(new.non_separator_tokens.total),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@ impl Aggregate for IndexSwappedAnalytics {
|
|||||||
"Indexes Swapped"
|
"Indexes Swapped"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
Box::new(Self {
|
Box::new(Self {
|
||||||
swap_operation_number: self.swap_operation_number.max(other.swap_operation_number),
|
swap_operation_number: self.swap_operation_number.max(new.swap_operation_number),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,25 +185,25 @@ impl<Method: AggregateMethod + 'static> Aggregate for TaskFilterAnalytics<Method
|
|||||||
Method::event_name()
|
Method::event_name()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate(self: Box<Self>, other: Box<Self>) -> Box<Self> {
|
fn aggregate(self: Box<Self>, new: Box<Self>) -> Box<Self> {
|
||||||
Box::new(Self {
|
Box::new(Self {
|
||||||
filtered_by_uid: self.filtered_by_uid | other.filtered_by_uid,
|
filtered_by_uid: self.filtered_by_uid | new.filtered_by_uid,
|
||||||
filtered_by_index_uid: self.filtered_by_index_uid | other.filtered_by_index_uid,
|
filtered_by_index_uid: self.filtered_by_index_uid | new.filtered_by_index_uid,
|
||||||
filtered_by_type: self.filtered_by_type | other.filtered_by_type,
|
filtered_by_type: self.filtered_by_type | new.filtered_by_type,
|
||||||
filtered_by_status: self.filtered_by_status | other.filtered_by_status,
|
filtered_by_status: self.filtered_by_status | new.filtered_by_status,
|
||||||
filtered_by_canceled_by: self.filtered_by_canceled_by | other.filtered_by_canceled_by,
|
filtered_by_canceled_by: self.filtered_by_canceled_by | new.filtered_by_canceled_by,
|
||||||
filtered_by_before_enqueued_at: self.filtered_by_before_enqueued_at
|
filtered_by_before_enqueued_at: self.filtered_by_before_enqueued_at
|
||||||
| other.filtered_by_before_enqueued_at,
|
| new.filtered_by_before_enqueued_at,
|
||||||
filtered_by_after_enqueued_at: self.filtered_by_after_enqueued_at
|
filtered_by_after_enqueued_at: self.filtered_by_after_enqueued_at
|
||||||
| other.filtered_by_after_enqueued_at,
|
| new.filtered_by_after_enqueued_at,
|
||||||
filtered_by_before_started_at: self.filtered_by_before_started_at
|
filtered_by_before_started_at: self.filtered_by_before_started_at
|
||||||
| other.filtered_by_before_started_at,
|
| new.filtered_by_before_started_at,
|
||||||
filtered_by_after_started_at: self.filtered_by_after_started_at
|
filtered_by_after_started_at: self.filtered_by_after_started_at
|
||||||
| other.filtered_by_after_started_at,
|
| new.filtered_by_after_started_at,
|
||||||
filtered_by_before_finished_at: self.filtered_by_before_finished_at
|
filtered_by_before_finished_at: self.filtered_by_before_finished_at
|
||||||
| other.filtered_by_before_finished_at,
|
| new.filtered_by_before_finished_at,
|
||||||
filtered_by_after_finished_at: self.filtered_by_after_finished_at
|
filtered_by_after_finished_at: self.filtered_by_after_finished_at
|
||||||
| other.filtered_by_after_finished_at,
|
| new.filtered_by_after_finished_at,
|
||||||
|
|
||||||
marker: std::marker::PhantomData,
|
marker: std::marker::PhantomData,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user