3 final class PhabricatorSearchDocument
extends PhabricatorSearchDAO
{
5 protected $documentType;
6 protected $documentTitle;
7 protected $documentCreated;
8 protected $documentModified;
10 const STOPWORDS_TABLE
= 'stopwords';
12 protected function getConfiguration() {
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',
22 self
::CONFIG_KEY_SCHEMA
=> array(
25 'columns' => array('phid'),
28 'documentCreated' => array(
29 'columns' => array('documentCreated'),
32 'columns' => array('documentType', 'documentCreated'),
35 ) + parent
::getConfiguration();
38 public function getIDKey() {
42 public static function newQueryCompiler() {
43 $compiler = new PhutilSearchQueryCompiler();
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.
50 $conn = $table->establishConnection('r');
52 $operators = queryfx_one(
54 'SELECT @@ft_boolean_syntax AS syntax');
56 $compiler->setOperators($operators['syntax']);
63 public static function isInnoDBFulltextEngineAvailable() {
66 if ($available === null) {
68 $conn = $table->establishConnection('r');
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.
75 'SELECT @@innodb_ft_max_token_size');
77 } catch (AphrontQueryException
$x) {