Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conpherence/query/ConpherenceThreadQuery.php
Show First 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | if ($conpherences) { | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return $conpherences; | return $conpherences; | ||||
} | } | ||||
protected function buildGroupClause(AphrontDatabaseConnection $conn_r) { | protected function buildGroupClause(AphrontDatabaseConnection $conn_r) { | ||||
if ($this->participantPHIDs !== null || strlen($this->fulltext)) { | if ($this->participantPHIDs !== null | ||||
|| ($this->fulltext !== null && strlen($this->fulltext))) { | |||||
return qsprintf($conn_r, 'GROUP BY thread.id'); | return qsprintf($conn_r, 'GROUP BY thread.id'); | ||||
} else { | } else { | ||||
return $this->buildApplicationSearchGroupClause($conn_r); | return $this->buildApplicationSearchGroupClause($conn_r); | ||||
} | } | ||||
} | } | ||||
protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | ||||
$joins = parent::buildJoinClauseParts($conn); | $joins = parent::buildJoinClauseParts($conn); | ||||
if ($this->participantPHIDs !== null) { | if ($this->participantPHIDs !== null) { | ||||
$joins[] = qsprintf( | $joins[] = qsprintf( | ||||
$conn, | $conn, | ||||
'JOIN %T p ON p.conpherencePHID = thread.phid', | 'JOIN %T p ON p.conpherencePHID = thread.phid', | ||||
id(new ConpherenceParticipant())->getTableName()); | id(new ConpherenceParticipant())->getTableName()); | ||||
} | } | ||||
if (strlen($this->fulltext)) { | if ($this->fulltext !== null && strlen($this->fulltext)) { | ||||
$joins[] = qsprintf( | $joins[] = qsprintf( | ||||
$conn, | $conn, | ||||
'JOIN %T idx ON idx.threadPHID = thread.phid', | 'JOIN %T idx ON idx.threadPHID = thread.phid', | ||||
id(new ConpherenceIndex())->getTableName()); | id(new ConpherenceIndex())->getTableName()); | ||||
} | } | ||||
// See note in buildWhereClauseParts() about this optimization. | // See note in buildWhereClauseParts() about this optimization. | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
if ($this->participantPHIDs !== null) { | if ($this->participantPHIDs !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'p.participantPHID IN (%Ls)', | 'p.participantPHID IN (%Ls)', | ||||
$this->participantPHIDs); | $this->participantPHIDs); | ||||
} | } | ||||
if (strlen($this->fulltext)) { | if ($this->fulltext !== null && strlen($this->fulltext)) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'MATCH(idx.corpus) AGAINST (%s IN BOOLEAN MODE)', | 'MATCH(idx.corpus) AGAINST (%s IN BOOLEAN MODE)', | ||||
$this->fulltext); | $this->fulltext); | ||||
} | } | ||||
return $where; | return $where; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |