[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/project/search/ -> PhabricatorProjectSearchIndexer.php (source)

   1  <?php
   2  
   3  final class PhabricatorProjectSearchIndexer
   4    extends PhabricatorSearchDocumentIndexer {
   5  
   6    public function getIndexableObject() {
   7      return new PhabricatorProject();
   8    }
   9  
  10    protected function buildAbstractDocumentByPHID($phid) {
  11      $project = $this->loadDocumentByPHID($phid);
  12      $project->updateDatasourceTokens();
  13  
  14      $doc = new PhabricatorSearchAbstractDocument();
  15      $doc->setPHID($project->getPHID());
  16      $doc->setDocumentType(PhabricatorProjectProjectPHIDType::TYPECONST);
  17      $doc->setDocumentTitle($project->getName());
  18      $doc->setDocumentCreated($project->getDateCreated());
  19      $doc->setDocumentModified($project->getDateModified());
  20  
  21      $doc->addRelationship(
  22        $project->isArchived()
  23          ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED
  24          : PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
  25        $project->getPHID(),
  26        PhabricatorProjectProjectPHIDType::TYPECONST,
  27        time());
  28  
  29      // NOTE: This could be more full-featured, but for now we're mostly
  30      // interested in the side effects of indexing.
  31  
  32      return $doc;
  33    }
  34  
  35  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1