@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at recaptime-dev/main 39 lines 1.1 kB view raw
1<?php 2 3final class PhabricatorCustomFieldFulltextEngineExtension 4 extends PhabricatorFulltextEngineExtension { 5 6 const EXTENSIONKEY = 'customfield.fields'; 7 8 public function getExtensionName() { 9 return pht('Custom Fields'); 10 } 11 12 public function shouldEnrichFulltextObject($object) { 13 return ($object instanceof PhabricatorCustomFieldInterface); 14 } 15 16 public function enrichFulltextObject( 17 $object, 18 PhabricatorSearchAbstractDocument $document) { 19 20 // Rebuild the ApplicationSearch indexes. These are internal and not part 21 // of the fulltext search, but putting them in this workflow allows users 22 // to use the same tools to rebuild the indexes, which is easy to 23 // understand. 24 25 $field_list = PhabricatorCustomField::getObjectFields( 26 $object, 27 PhabricatorCustomField::ROLE_DEFAULT); 28 29 $field_list->setViewer($this->getViewer()); 30 $field_list->readFieldsFromStorage($object); 31 32 // Rebuild ApplicationSearch indexes. 33 $field_list->rebuildIndexes($object); 34 35 // Rebuild global search indexes. 36 $field_list->updateAbstractDocument($document); 37 } 38 39}