Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15384244
D10748.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10748.diff
View Options
diff --git a/src/applications/project/customfield/PhabricatorProjectDescriptionField.php b/src/applications/project/customfield/PhabricatorProjectDescriptionField.php
--- a/src/applications/project/customfield/PhabricatorProjectDescriptionField.php
+++ b/src/applications/project/customfield/PhabricatorProjectDescriptionField.php
@@ -11,6 +11,7 @@
'name' => pht('Description'),
'type' => 'remarkup',
'description' => pht('Short project description.'),
+ 'fulltext' => PhabricatorSearchField::FIELD_BODY,
),
));
}
diff --git a/src/docs/user/configuration/custom_fields.diviner b/src/docs/user/configuration/custom_fields.diviner
--- a/src/docs/user/configuration/custom_fields.diviner
+++ b/src/docs/user/configuration/custom_fields.diviner
@@ -102,6 +102,9 @@
defaults to `true`). (Note: Empty fields are not shown.)
- **search**: Show this field on the application's search interface, allowing
users to filter objects by the field value.
+ - **fulltext**: Index the text in this field as part of the object's global
+ full-text index. This allows users to find the object by searching for
+ the field's contents using global search.
- **caption**: A caption to display underneath the field (optional).
- **required**: True if the user should be required to provide a value.
- **options**: If type is set to **select**, provide options for the dropdown
diff --git a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
--- a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
+++ b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
@@ -339,8 +339,6 @@
}
$field->updateAbstractDocument($document);
}
-
- return $document;
}
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
--- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
@@ -402,4 +402,25 @@
return 'std:control:'.$key;
}
+ public function shouldAppearInGlobalSearch() {
+ return $this->getFieldConfigValue('fulltext', false);
+ }
+
+ public function updateAbstractDocument(
+ PhabricatorSearchAbstractDocument $document) {
+
+ $field_key = $this->getFieldConfigValue('fulltext');
+
+ // If the caller or configuration didn't specify a valid field key,
+ // generate one automatically from the field index.
+ if (!is_string($field_key) || (strlen($field_key) != 4)) {
+ $field_key = '!'.substr($this->getFieldIndex(), 0, 3);
+ }
+
+ $field_value = $this->getFieldValue();
+ if (strlen($field_value)) {
+ $document->addField($field_key, $field_value);
+ }
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 15, 7:15 PM (2 w, 22 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7332914
Default Alt Text
D10748.diff (2 KB)
Attached To
Mode
D10748: Allow standard custom fields to be indexed in global fulltext search
Attached
Detach File
Event Timeline
Log In to Comment