forked from leftypol/leftypol
SearchService.php: handle filters getting trimmed into oblivion
This commit is contained in:
parent
75ce687af5
commit
360161b1fc
1 changed files with 8 additions and 5 deletions
|
|
@ -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 ];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue