Page MenuHomePhabricator

D12588.diff
No OneTemporary

D12588.diff

diff --git a/src/applications/conpherence/query/ConpherenceThreadQuery.php b/src/applications/conpherence/query/ConpherenceThreadQuery.php
--- a/src/applications/conpherence/query/ConpherenceThreadQuery.php
+++ b/src/applications/conpherence/query/ConpherenceThreadQuery.php
@@ -17,6 +17,7 @@
private $afterTransactionID;
private $beforeTransactionID;
private $transactionLimit;
+ private $fulltext;
public function needFilePHIDs($need_file_phids) {
$this->needFilePHIDs = $need_file_phids;
@@ -82,6 +83,11 @@
return $this->transactionLimit;
}
+ public function withFulltext($query) {
+ $this->fulltext = $query;
+ return $this;
+ }
+
protected function loadPage() {
$table = new ConpherenceThread();
$conn_r = $table->establishConnection('r');
@@ -122,7 +128,7 @@
}
protected function buildGroupClause(AphrontDatabaseConnection $conn_r) {
- if ($this->participantPHIDs !== null) {
+ if ($this->participantPHIDs !== null || strlen($this->fulltext)) {
return 'GROUP BY conpherence_thread.id';
} else {
return $this->buildApplicationSearchGroupClause($conn_r);
@@ -149,6 +155,12 @@
$viewer->getPHID());
}
+ if (strlen($this->fulltext)) {
+ $joins[] = qsprintf(
+ $conn_r,
+ 'JOIN %T idx ON idx.threadPHID = conpherence_thread.phid',
+ id(new ConpherenceIndex())->getTableName());
+ }
$joins[] = $this->buildApplicationSearchJoinClause($conn_r);
return implode(' ', $joins);
@@ -196,6 +208,13 @@
(int)$this->isRoom);
}
+ if (strlen($this->fulltext)) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'MATCH(idx.corpus) AGAINST (%s IN BOOLEAN MODE)',
+ $this->fulltext);
+ }
+
$viewer = $this->getViewer();
if ($this->shouldJoinForViewer($viewer)) {
$where[] = qsprintf(
diff --git a/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php b/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
--- a/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
+++ b/src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
@@ -18,6 +18,8 @@
'participantPHIDs',
$this->readUsersFromRequest($request, 'participants'));
+ $saved->setParameter('fulltext', $request->getStr('fulltext'));
+
$saved->setParameter(
'threadType',
$request->getStr('threadType'));
@@ -34,6 +36,11 @@
$query->withParticipantPHIDs($participant_phids);
}
+ $fulltext = $saved->getParameter('fulltext');
+ if (strlen($fulltext)) {
+ $query->withFulltext($fulltext);
+ }
+
$thread_type = $saved->getParameter('threadType');
if (idx($this->getTypeOptions(), $thread_type)) {
switch ($thread_type) {
@@ -57,6 +64,7 @@
PhabricatorSavedQuery $saved) {
$participant_phids = $saved->getParameter('participantPHIDs', array());
+ $fulltext = $saved->getParameter('fulltext');
$form
->appendControl(
@@ -66,6 +74,11 @@
->setLabel(pht('Participants'))
->setValue($participant_phids))
->appendControl(
+ id(new AphrontFormTextControl())
+ ->setName('fulltext')
+ ->setLabel(pht('Contains Words'))
+ ->setValue($fulltext))
+ ->appendControl(
id(new AphrontFormSelectControl())
->setLabel(pht('Type'))
->setName('threadType')

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 12, 5:32 AM (1 w, 4 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6712606
Default Alt Text
D12588.diff (3 KB)

Event Timeline