Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / conpherence / controller / ConpherenceThreadSearchController.php
blob155a61c23420187e4896f83c45779c779c7eb17f
1 <?php
3 final class ConpherenceThreadSearchController
4 extends ConpherenceController {
6 public function shouldAllowPublic() {
7 return true;
10 public function handleRequest(AphrontRequest $request) {
11 $viewer = $request->getViewer();
12 $conpherence_id = $request->getURIData('id');
13 $fulltext = $request->getStr('fulltext');
15 $conpherence = id(new ConpherenceThreadQuery())
16 ->setViewer($viewer)
17 ->withIDs(array($conpherence_id))
18 ->executeOne();
20 if (!$conpherence) {
21 return new Aphront404Response();
24 $engine = new ConpherenceThreadSearchEngine();
25 $engine->setViewer($viewer);
26 $saved = $engine->buildSavedQueryFromBuiltin('all')
27 ->setParameter('phids', array($conpherence->getPHID()))
28 ->setParameter('fulltext', $fulltext);
30 $pager = $engine->newPagerForSavedQuery($saved);
31 $pager->setPageSize(15);
33 $query = $engine->buildQueryFromSavedQuery($saved);
35 $results = $engine->executeQuery($query, $pager);
36 $view = $engine->renderResults($results, $saved);
38 return id(new AphrontAjaxResponse())
39 ->setContent($view->getContent());