mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-18 15:20:10 +01:00
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
This commit is contained in:
parent
515cb98819
commit
64234535e3
2 changed files with 17 additions and 9 deletions
src/applications
project/search
search/constants
|
@ -8,17 +8,26 @@ final class PhabricatorProjectFulltextEngine
|
||||||
$object) {
|
$object) {
|
||||||
|
|
||||||
$project = $object;
|
$project = $object;
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
// Reload the project to get slugs.
|
||||||
|
$project = id(new PhabricatorProjectQuery())
|
||||||
|
->withIDs(array($project->getID()))
|
||||||
|
->setViewer($viewer)
|
||||||
|
->needSlugs(true)
|
||||||
|
->executeOne();
|
||||||
|
|
||||||
$project->updateDatasourceTokens();
|
$project->updateDatasourceTokens();
|
||||||
|
|
||||||
$document->setDocumentTitle($project->getDisplayName());
|
$slugs = array();
|
||||||
$document->addField(PhabricatorSearchDocumentFieldType::FIELD_KEYWORDS,
|
foreach ($project->getSlugs() as $slug) {
|
||||||
$project->getPrimarySlug());
|
$slugs[] = $slug->getSlug();
|
||||||
try {
|
|
||||||
$slugs = $project->getSlugs();
|
|
||||||
foreach ($slugs as $slug) {}
|
|
||||||
} catch (PhabricatorDataNotAttachedException $e) {
|
|
||||||
// ignore
|
|
||||||
}
|
}
|
||||||
|
$body = implode("\n", $slugs);
|
||||||
|
|
||||||
|
$document
|
||||||
|
->setDocumentTitle($project->getDisplayName())
|
||||||
|
->addField(PhabricatorSearchDocumentFieldType::FIELD_BODY, $body);
|
||||||
|
|
||||||
$document->addRelationship(
|
$document->addRelationship(
|
||||||
$project->isArchived()
|
$project->isArchived()
|
||||||
|
|
|
@ -5,6 +5,5 @@ final class PhabricatorSearchDocumentFieldType extends Phobject {
|
||||||
const FIELD_TITLE = 'titl';
|
const FIELD_TITLE = 'titl';
|
||||||
const FIELD_BODY = 'body';
|
const FIELD_BODY = 'body';
|
||||||
const FIELD_COMMENT = 'cmnt';
|
const FIELD_COMMENT = 'cmnt';
|
||||||
const FIELD_KEYWORDS = 'kwrd';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue