@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 85 lines 2.2 kB view raw
1<?php 2 3final class PhabricatorSearchDocument extends PhabricatorSearchDAO { 4 5 protected $documentType; 6 protected $documentTitle; 7 protected $documentCreated; 8 protected $documentModified; 9 10 const STOPWORDS_TABLE = 'stopwords'; 11 12 protected function getConfiguration() { 13 return array( 14 self::CONFIG_TIMESTAMPS => false, 15 self::CONFIG_IDS => self::IDS_MANUAL, 16 self::CONFIG_COLUMN_SCHEMA => array( 17 'documentType' => 'text4', 18 'documentTitle' => 'text255', 19 'documentCreated' => 'epoch', 20 'documentModified' => 'epoch', 21 ), 22 self::CONFIG_KEY_SCHEMA => array( 23 'key_phid' => null, 24 'PRIMARY' => array( 25 'columns' => array('phid'), 26 'unique' => true, 27 ), 28 'documentCreated' => array( 29 'columns' => array('documentCreated'), 30 ), 31 'key_type' => array( 32 'columns' => array('documentType', 'documentCreated'), 33 ), 34 ), 35 ) + parent::getConfiguration(); 36 } 37 38 public function getIDKey() { 39 return 'phid'; 40 } 41 42 public static function newQueryCompiler() { 43 $compiler = new PhutilSearchQueryCompiler(); 44 45 if (self::isInnoDBFulltextEngineAvailable()) { 46 // The InnoDB fulltext boolean operators are always the same as the 47 // default MyISAM operators, so we do not need to adjust the compiler. 48 } else { 49 $table = new self(); 50 $conn = $table->establishConnection('r'); 51 52 $operators = queryfx_one( 53 $conn, 54 'SELECT @@ft_boolean_syntax AS syntax'); 55 if ($operators) { 56 $compiler->setOperators($operators['syntax']); 57 } 58 } 59 60 return $compiler; 61 } 62 63 public static function isInnoDBFulltextEngineAvailable() { 64 static $available; 65 66 if ($available === null) { 67 $table = new self(); 68 $conn = $table->establishConnection('r'); 69 70 // If this system variable exists, we can use InnoDB fulltext. If it 71 // does not, this query will throw and we're stuck with MyISAM. 72 try { 73 queryfx_one( 74 $conn, 75 'SELECT @@innodb_ft_max_token_size'); 76 $available = true; 77 } catch (AphrontQueryException $x) { 78 $available = false; 79 } 80 } 81 82 return $available; 83 } 84 85}