Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/index/PhabricatorSearchDocumentIndexer.php
| Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | foreach ($xactions as $xaction) { | ||||
| $comment = $xaction->getComment(); | $comment = $xaction->getComment(); | ||||
| $doc->addField( | $doc->addField( | ||||
| PhabricatorSearchField::FIELD_COMMENT, | PhabricatorSearchField::FIELD_COMMENT, | ||||
| $comment->getContent()); | $comment->getContent()); | ||||
| } | } | ||||
| } | } | ||||
| protected function indexCustomFields( | |||||
| PhabricatorSearchAbstractDocument $doc, | |||||
| PhabricatorCustomFieldInterface $object) { | |||||
| // Rebuild the ApplicationSearch indexes. These are internal and not part of | |||||
| // the fulltext search, but putting them in this workflow allows users to | |||||
| // use the same tools to rebuild the indexes, which is easy to understand. | |||||
| $field_list = PhabricatorCustomField::getObjectFields( | |||||
| $object, | |||||
| PhabricatorCustomField::ROLE_APPLICATIONSEARCH); | |||||
| $field_list->setViewer($this->getViewer()); | |||||
| $field_list->readFieldsFromStorage($object); | |||||
| $field_list->rebuildIndexes($object); | |||||
| // We could also allow fields to provide fulltext content, and index it | |||||
| // here on the document. No one has asked for this yet, though, and the | |||||
| // existing "search" key isn't a good fit to interpret to mean we should | |||||
| // index stuff here, since it can be set on a lot of fields which don't | |||||
| // contain anything resembling fulltext. | |||||
| } | |||||
| private function dispatchDidUpdateIndexEvent( | private function dispatchDidUpdateIndexEvent( | ||||
| $phid, | $phid, | ||||
| PhabricatorSearchAbstractDocument $document) { | PhabricatorSearchAbstractDocument $document) { | ||||
| $event = new PhabricatorEvent( | $event = new PhabricatorEvent( | ||||
| PhabricatorEventType::TYPE_SEARCH_DIDUPDATEINDEX, | PhabricatorEventType::TYPE_SEARCH_DIDUPDATEINDEX, | ||||
| array( | array( | ||||
| 'phid' => $phid, | 'phid' => $phid, | ||||
| 'object' => $this->loadDocumentByPHID($phid), | 'object' => $this->loadDocumentByPHID($phid), | ||||
| 'document' => $document, | 'document' => $document, | ||||
| )); | )); | ||||
| $event->setUser($this->getViewer()); | $event->setUser($this->getViewer()); | ||||
| PhutilEventEngine::dispatchEvent($event); | PhutilEventEngine::dispatchEvent($event); | ||||
| } | } | ||||
| } | } | ||||