SearchService.php: handle filters getting trimmed into oblivion

This commit is contained in:
Zankaria 2025-07-08 21:28:16 +02:00
parent 75ce687af5
commit 360161b1fc

View file

@ -116,11 +116,14 @@ class SearchService {
} }
} }
$wildcard_weight = 0;
if (!empty($acc) && $total_len >= 0) {
// Interword wildcards // Interword wildcards
$interword = \min(\count($fragments) - 1, 0); $interword = \min(\count($fragments) - 1, 0);
// Wildcards over the total length of the word. Ergo the number of fragments minus 1. // Wildcards over the total length of the word. Ergo the number of fragments minus 1.
$perc = $interword / $total_len * 100; $perc = $interword / $total_len * 100;
$wildcard_weight = $perc + \count($fragments) * 2; $wildcard_weight = $perc + \count($fragments) * 2;
}
return [ $acc, $total_len, $wildcard_weight ]; return [ $acc, $total_len, $wildcard_weight ];
} }