@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.

Allow standard custom fields to be indexed in global fulltext search

Summary: Fixes T6399. This allows you to use global search to find projects by searching for text in their descriptions.

Test Plan: Added a unique word to a project description, reindexed it, searched, got a hit.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6399

Differential Revision: https://secure.phabricator.com/D10748

+25 -2
+1
src/applications/project/customfield/PhabricatorProjectDescriptionField.php
··· 11 11 'name' => pht('Description'), 12 12 'type' => 'remarkup', 13 13 'description' => pht('Short project description.'), 14 + 'fulltext' => PhabricatorSearchField::FIELD_BODY, 14 15 ), 15 16 )); 16 17 }
+3
src/docs/user/configuration/custom_fields.diviner
··· 102 102 defaults to `true`). (Note: Empty fields are not shown.) 103 103 - **search**: Show this field on the application's search interface, allowing 104 104 users to filter objects by the field value. 105 + - **fulltext**: Index the text in this field as part of the object's global 106 + full-text index. This allows users to find the object by searching for 107 + the field's contents using global search. 105 108 - **caption**: A caption to display underneath the field (optional). 106 109 - **required**: True if the user should be required to provide a value. 107 110 - **options**: If type is set to **select**, provide options for the dropdown
-2
src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
··· 339 339 } 340 340 $field->updateAbstractDocument($document); 341 341 } 342 - 343 - return $document; 344 342 } 345 343 346 344
+21
src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
··· 402 402 return 'std:control:'.$key; 403 403 } 404 404 405 + public function shouldAppearInGlobalSearch() { 406 + return $this->getFieldConfigValue('fulltext', false); 407 + } 408 + 409 + public function updateAbstractDocument( 410 + PhabricatorSearchAbstractDocument $document) { 411 + 412 + $field_key = $this->getFieldConfigValue('fulltext'); 413 + 414 + // If the caller or configuration didn't specify a valid field key, 415 + // generate one automatically from the field index. 416 + if (!is_string($field_key) || (strlen($field_key) != 4)) { 417 + $field_key = '!'.substr($this->getFieldIndex(), 0, 3); 418 + } 419 + 420 + $field_value = $this->getFieldValue(); 421 + if (strlen($field_value)) { 422 + $document->addField($field_key, $field_value); 423 + } 424 + } 425 + 405 426 }