Take into account PR messages

This commit is contained in:
ManyTheFish 2025-03-10 13:46:33 +01:00
parent ed1dcbe0f7
commit 689e69d6d2
5 changed files with 18 additions and 24 deletions

View File

@ -55,7 +55,7 @@ fn match_pattern(pattern: &str, str: &str) -> PatternMatch {
if pattern == "*" {
return PatternMatch::Match;
} else if pattern.starts_with('*') && pattern.ends_with('*') {
// If the starts and ends with a wildcard, return Match if the string contains the pattern without the wildcards
// If the pattern starts and ends with a wildcard, return Match if the string contains the pattern without the wildcards
if str.contains(&pattern[1..pattern.len() - 1]) {
return PatternMatch::Match;
}

View File

@ -43,11 +43,6 @@ impl FieldidsWeightsMap {
self.map.get(&fid).copied()
}
/// Returns highest weight contained in the map if any.
pub fn max_weight(&self) -> Option<Weight> {
self.map.values().copied().max()
}
/// Return an iterator visiting all field ids in arbitrary order.
pub fn ids(&self) -> impl Iterator<Item = FieldId> + '_ {
self.map.keys().copied()

View File

@ -92,10 +92,7 @@ impl RankingRuleGraphTrait for FidGraph {
}
// always lookup the max_fid if we don't already and add an artificial condition for max scoring
let max_weight = ctx
.index
.max_searchable_attribute_weight(ctx.txn)?
.or_else(|| weights_map.max_weight());
let max_weight = ctx.index.max_searchable_attribute_weight(ctx.txn)?;
if let Some(max_weight) = max_weight {
if current_max_weight < max_weight {

View File

@ -745,12 +745,14 @@ impl<'a, 'i> Transform<'a, 'i> {
} else {
let facet_operation = necessary_faceted_field(id);
let searchable_operation = settings_diff.reindex_searchable_id(id);
let operation = facet_operation
// TODO: replace `zip.map` with `zip_with` once stable
.zip(searchable_operation)
.map(|(op1, op2)| op1.merge(op2))
.or(facet_operation)
.or(searchable_operation);
let operation = match (facet_operation, searchable_operation) {
(Some(facet_operation), Some(searchable_operation)) => {
Some(facet_operation.merge(searchable_operation))
}
(Some(operation), None) | (None, Some(operation)) => Some(operation),
(None, None) => None,
};
if let Some(operation) = operation {
operations.insert(id, operation);
obkv_writer.insert(id, val)?;

View File

@ -30,10 +30,10 @@ pub struct FacetedExtractorData<'a, 'b> {
sender: &'a FieldIdDocidFacetSender<'a, 'b>,
grenad_parameters: &'a GrenadParameters,
buckets: usize,
filterable_attributes: Vec<FilterableAttributesRule>,
sortable_fields: HashSet<String>,
asc_desc_fields: HashSet<String>,
distinct_field: Option<String>,
filterable_attributes: &'a [FilterableAttributesRule],
sortable_fields: &'a HashSet<String>,
asc_desc_fields: &'a HashSet<String>,
distinct_field: &'a Option<String>,
is_geo_enabled: bool,
}
@ -478,10 +478,10 @@ impl FacetedDocidsExtractor {
grenad_parameters: indexing_context.grenad_parameters,
buckets: rayon::current_num_threads(),
sender,
filterable_attributes,
sortable_fields,
asc_desc_fields,
distinct_field,
filterable_attributes: &filterable_attributes,
sortable_fields: &sortable_fields,
asc_desc_fields: &asc_desc_fields,
distinct_field: &distinct_field,
is_geo_enabled,
};
extract(