Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F469955
ConpherenceFulltextQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ConpherenceFulltextQuery.php
View Options
<?php
final
class
ConpherenceFulltextQuery
extends
PhabricatorOffsetPagedQuery
{
private
$threadPHIDs
;
private
$fulltext
;
public
function
withThreadPHIDs
(
array
$phids
)
{
$this
->
threadPHIDs
=
$phids
;
return
$this
;
}
public
function
withFulltext
(
$fulltext
)
{
$this
->
fulltext
=
$fulltext
;
return
$this
;
}
public
function
execute
()
{
$table
=
new
ConpherenceIndex
();
$conn_r
=
$table
->
establishConnection
(
'r'
);
$rows
=
queryfx_all
(
$conn_r
,
'SELECT threadPHID, transactionPHID, previousTransactionPHID
FROM %T i %Q %Q %Q'
,
$table
->
getTableName
(),
$this
->
buildWhereClause
(
$conn_r
),
$this
->
buildOrderByClause
(
$conn_r
),
$this
->
buildLimitClause
(
$conn_r
));
return
$rows
;
}
protected
function
buildWhereClause
(
AphrontDatabaseConnection
$conn_r
)
{
$where
=
array
();
if
(
$this
->
threadPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'i.threadPHID IN (%Ls)'
,
$this
->
threadPHIDs
);
}
if
(
strlen
(
$this
->
fulltext
))
{
$where
[]
=
qsprintf
(
$conn_r
,
'MATCH(i.corpus) AGAINST (%s IN BOOLEAN MODE)'
,
$this
->
fulltext
);
}
return
$this
->
formatWhereClause
(
$where
);
}
private
function
buildOrderByClause
(
AphrontDatabaseConnection
$conn_r
)
{
if
(
strlen
(
$this
->
fulltext
))
{
return
qsprintf
(
$conn_r
,
'ORDER BY MATCH(i.corpus) AGAINST (%s IN BOOLEAN MODE) DESC'
,
$this
->
fulltext
);
}
else
{
return
qsprintf
(
$conn_r
,
'ORDER BY id DESC'
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 6, 10:02 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
82707
Default Alt Text
ConpherenceFulltextQuery.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment