Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/search/DivinerLiveSymbolFulltextEngine.php
- This file was moved from src/applications/diviner/search/DivinerAtomSearchIndexer.php.
<?php | <?php | ||||
final class DivinerAtomSearchIndexer extends PhabricatorSearchDocumentIndexer { | final class DivinerLiveSymbolFulltextEngine | ||||
extends PhabricatorFulltextEngine { | |||||
public function getIndexableObject() { | protected function buildAbstractDocument( | ||||
return new DivinerLiveSymbol(); | PhabricatorSearchAbstractDocument $document, | ||||
} | $object) { | ||||
protected function buildAbstractDocumentByPHID($phid) { | $atom = $object; | ||||
$atom = $this->loadDocumentByPHID($phid); | |||||
$book = $atom->getBook(); | $book = $atom->getBook(); | ||||
if (!$atom->getIsDocumentable()) { | $document | ||||
return null; | |||||
} | |||||
$doc = $this->newDocument($phid) | |||||
->setDocumentTitle($atom->getTitle()) | ->setDocumentTitle($atom->getTitle()) | ||||
->setDocumentCreated($book->getDateCreated()) | ->setDocumentCreated($book->getDateCreated()) | ||||
->setDocumentModified($book->getDateModified()); | ->setDocumentModified($book->getDateModified()); | ||||
$doc->addField( | $document->addField( | ||||
PhabricatorSearchDocumentFieldType::FIELD_BODY, | PhabricatorSearchDocumentFieldType::FIELD_BODY, | ||||
$atom->getSummary()); | $atom->getSummary()); | ||||
$doc->addRelationship( | $document->addRelationship( | ||||
PhabricatorSearchRelationship::RELATIONSHIP_BOOK, | PhabricatorSearchRelationship::RELATIONSHIP_BOOK, | ||||
$atom->getBookPHID(), | $atom->getBookPHID(), | ||||
DivinerBookPHIDType::TYPECONST, | DivinerBookPHIDType::TYPECONST, | ||||
PhabricatorTime::getNow()); | PhabricatorTime::getNow()); | ||||
$doc->addRelationship( | $document->addRelationship( | ||||
PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, | PhabricatorSearchRelationship::RELATIONSHIP_REPOSITORY, | ||||
$atom->getRepositoryPHID(), | $atom->getRepositoryPHID(), | ||||
PhabricatorRepositoryRepositoryPHIDType::TYPECONST, | PhabricatorRepositoryRepositoryPHIDType::TYPECONST, | ||||
PhabricatorTime::getNow()); | PhabricatorTime::getNow()); | ||||
$doc->addRelationship( | $document->addRelationship( | ||||
$atom->getGraphHash() | $atom->getGraphHash() | ||||
? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED | ? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED | ||||
: PhabricatorSearchRelationship::RELATIONSHIP_OPEN, | : PhabricatorSearchRelationship::RELATIONSHIP_OPEN, | ||||
$atom->getBookPHID(), | $atom->getBookPHID(), | ||||
DivinerBookPHIDType::TYPECONST, | DivinerBookPHIDType::TYPECONST, | ||||
PhabricatorTime::getNow()); | PhabricatorTime::getNow()); | ||||
return $doc; | |||||
} | } | ||||
} | } |