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

Remove FIELD_KEYWORDS, index project slugs as body content

Summary:
D17384 added a "keywords" field but only partially implemented it.

- Remove this field.
- Index project slugs as part of the document body instead.

Test Plan:
- Ran `bin/search index PHID-PROJ-... --force`.
- Found project by searching for a unique slug.

Reviewers: chad, 20after4

Reviewed By: chad

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

+17 -9
+17 -8
src/applications/project/search/PhabricatorProjectFulltextEngine.php
··· 8 8 $object) { 9 9 10 10 $project = $object; 11 + $viewer = $this->getViewer(); 12 + 13 + // Reload the project to get slugs. 14 + $project = id(new PhabricatorProjectQuery()) 15 + ->withIDs(array($project->getID())) 16 + ->setViewer($viewer) 17 + ->needSlugs(true) 18 + ->executeOne(); 19 + 11 20 $project->updateDatasourceTokens(); 12 21 13 - $document->setDocumentTitle($project->getDisplayName()); 14 - $document->addField(PhabricatorSearchDocumentFieldType::FIELD_KEYWORDS, 15 - $project->getPrimarySlug()); 16 - try { 17 - $slugs = $project->getSlugs(); 18 - foreach ($slugs as $slug) {} 19 - } catch (PhabricatorDataNotAttachedException $e) { 20 - // ignore 22 + $slugs = array(); 23 + foreach ($project->getSlugs() as $slug) { 24 + $slugs[] = $slug->getSlug(); 21 25 } 26 + $body = implode("\n", $slugs); 27 + 28 + $document 29 + ->setDocumentTitle($project->getDisplayName()) 30 + ->addField(PhabricatorSearchDocumentFieldType::FIELD_BODY, $body); 22 31 23 32 $document->addRelationship( 24 33 $project->isArchived()
-1
src/applications/search/constants/PhabricatorSearchDocumentFieldType.php
··· 5 5 const FIELD_TITLE = 'titl'; 6 6 const FIELD_BODY = 'body'; 7 7 const FIELD_COMMENT = 'cmnt'; 8 - const FIELD_KEYWORDS = 'kwrd'; 9 8 10 9 }