restore strong title match and keep prefix title fallback
This commit is contained in:
parent
e3dfc04192
commit
7cb4071a54
|
|
@ -317,6 +317,22 @@ class SearchController extends ListDiscussionsController
|
|||
protected function buildTextQuery(string $search, User $actor, bool $needsScoring = false): BoolQuery
|
||||
{
|
||||
$textQuery = BoolQuery::create();
|
||||
// Strong direct title match for the full search page.
|
||||
$textQuery->add(
|
||||
(new MatchQuery('title', $search))
|
||||
->operator('and')
|
||||
->boost(4.0),
|
||||
'should'
|
||||
);
|
||||
|
||||
// Low-weight prefix match on title.autocomplete for partial title hits.
|
||||
$textQuery->add(
|
||||
(new MatchQuery('title.autocomplete', $search))
|
||||
->operator('and')
|
||||
->boost(0.35),
|
||||
'should'
|
||||
);
|
||||
|
||||
// Low-weight prefix match on title.autocomplete for the full search page.
|
||||
// Exact / normal title matches should still rank higher than prefix-only hits.
|
||||
$textQuery->add(
|
||||
|
|
|
|||
Loading…
Reference in New Issue