mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 04:50:55 +01:00
Boost search result title matches
Summary: Ref T6740. When a query matches a document title, boost results. Test Plan: - Searched for `button bar`. - Before: {F2019463} - After: {F2019470} Reviewers: chad Reviewed By: chad Maniphest Tasks: T6740 Differential Revision: https://secure.phabricator.com/D16945
This commit is contained in:
parent
54470a12d4
commit
2b7ec1deea
1 changed files with 6 additions and 0 deletions
|
@ -197,12 +197,18 @@ final class PhabricatorMySQLFulltextStorageEngine
|
||||||
$join = array();
|
$join = array();
|
||||||
$where = array();
|
$where = array();
|
||||||
|
|
||||||
|
$title_field = PhabricatorSearchDocumentFieldType::FIELD_TITLE;
|
||||||
|
$title_boost = 1024;
|
||||||
|
|
||||||
$raw_query = $query->getParameter('query');
|
$raw_query = $query->getParameter('query');
|
||||||
$compiled_query = $this->compileQuery($raw_query);
|
$compiled_query = $this->compileQuery($raw_query);
|
||||||
if (strlen($compiled_query)) {
|
if (strlen($compiled_query)) {
|
||||||
$select[] = qsprintf(
|
$select[] = qsprintf(
|
||||||
$conn,
|
$conn,
|
||||||
|
'IF(field.field = %s, %d, 0) + '.
|
||||||
'MATCH(corpus) AGAINST (%s IN BOOLEAN MODE) AS fieldScore',
|
'MATCH(corpus) AGAINST (%s IN BOOLEAN MODE) AS fieldScore',
|
||||||
|
$title_field,
|
||||||
|
$title_boost,
|
||||||
$compiled_query);
|
$compiled_query);
|
||||||
|
|
||||||
$join[] = qsprintf(
|
$join[] = qsprintf(
|
||||||
|
|
Loading…
Reference in a new issue