add low-boost title autocomplete match to full search
This commit is contained in:
parent
e7e4495306
commit
e3dfc04192
|
|
@ -317,6 +317,15 @@ class SearchController extends ListDiscussionsController
|
||||||
protected function buildTextQuery(string $search, User $actor, bool $needsScoring = false): BoolQuery
|
protected function buildTextQuery(string $search, User $actor, bool $needsScoring = false): BoolQuery
|
||||||
{
|
{
|
||||||
$textQuery = BoolQuery::create();
|
$textQuery = BoolQuery::create();
|
||||||
|
// 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(
|
||||||
|
(new MatchQuery('title.autocomplete', $search))
|
||||||
|
->operator('and')
|
||||||
|
->boost(0.35),
|
||||||
|
'should'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
if ($this->discussionSearcher?->enabled()) {
|
if ($this->discussionSearcher?->enabled()) {
|
||||||
$textQuery->add($this->buildShouldClauses($search, $this->discussionSearcher->boost()), 'should');
|
$textQuery->add($this->buildShouldClauses($search, $this->discussionSearcher->boost()), 'should');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue