@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

In Ferret, allow documents with no title to match query terms by using LEFT JOIN on the "title" ranking field

Summary:
Fixes T13345. See D20650. Currently, `PhabricatorCursorPagedPolicyAwareQuery` does a JOIN against the "title" field so it can apply additional ranking/ordering conditions to the query.

This means that documents with no title (which don't have this field) are always excluded from the result set.

We'd prefer to include them, just not give them any bonus ranking/relevance boost. Use a LEFT JOIN so they get included.

Test Plan:
- Applied D20650 (diff 1), made it use raw `getTitle()` as the document title, indexed a paste with no title.
- Searched for a term in the paste body.
- Before change: no results.
- After change: found result.

{F6601159}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13345

Differential Revision: https://secure.phabricator.com/D20660

+13 -1
+13 -1
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
··· 1825 1825 $table_map['rank'] = array( 1826 1826 'alias' => 'ft_rank', 1827 1827 'key' => PhabricatorSearchDocumentFieldType::FIELD_TITLE, 1828 + 1829 + // See T13345. Not every document has a title, so we want to LEFT JOIN 1830 + // this table to avoid excluding documents with no title that match 1831 + // the query in other fields. 1832 + 'optional' => true, 1828 1833 ); 1829 1834 1830 1835 $this->ferretTables = $table_map; ··· 2103 2108 foreach ($this->ferretTables as $table) { 2104 2109 $alias = $table['alias']; 2105 2110 2111 + if (empty($table['optional'])) { 2112 + $join_type = qsprintf($conn, 'JOIN'); 2113 + } else { 2114 + $join_type = qsprintf($conn, 'LEFT JOIN'); 2115 + } 2116 + 2106 2117 $joins[] = qsprintf( 2107 2118 $conn, 2108 - 'JOIN %T %T ON ft_doc.id = %T.documentID 2119 + '%Q %T %T ON ft_doc.id = %T.documentID 2109 2120 AND %T.fieldKey = %s', 2121 + $join_type, 2110 2122 $field_table, 2111 2123 $alias, 2112 2124 $alias,