3 abstract class PhabricatorFulltextEngine
8 public function setObject($object) {
9 $this->object = $object;
13 public function getObject() {
17 protected function getViewer() {
18 return PhabricatorUser
::getOmnipotentUser();
21 abstract protected function buildAbstractDocument(
22 PhabricatorSearchAbstractDocument
$document,
25 final public function buildFulltextIndexes() {
26 $object = $this->getObject();
28 $extensions = PhabricatorFulltextEngineExtension
::getAllExtensions();
30 $enrich_extensions = array();
31 $index_extensions = array();
32 foreach ($extensions as $key => $extension) {
33 if ($extension->shouldEnrichFulltextObject($object)) {
34 $enrich_extensions[] = $extension;
37 if ($extension->shouldIndexFulltextObject($object)) {
38 $index_extensions[] = $extension;
42 $document = $this->newAbstractDocument($object);
44 $this->buildAbstractDocument($document, $object);
46 foreach ($enrich_extensions as $extension) {
47 $extension->enrichFulltextObject($object, $document);
50 foreach ($index_extensions as $extension) {
51 $extension->indexFulltextObject($object, $document);
54 PhabricatorSearchService
::reindexAbstractDocument($document);
57 protected function newAbstractDocument($object) {
58 $phid = $object->getPHID();
59 return id(new PhabricatorSearchAbstractDocument())
61 ->setDocumentType(phid_get_type($phid));