mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-11 08:06:13 +01:00
600a3e3b7c
Summary: Ref T7458. Only index documentable atoms in the search index. In particular, this prevents files and methods from being returned in search results (clicking on these search results doesn't actually work anyway). Test Plan: Actually, to get this to work I had to destroy the search index and recreate it... is this expected? Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T7458 Differential Revision: https://secure.phabricator.com/D13298
35 lines
868 B
PHP
35 lines
868 B
PHP
<?php
|
|
|
|
final class DivinerAtomSearchIndexer extends PhabricatorSearchDocumentIndexer {
|
|
|
|
public function getIndexableObject() {
|
|
return new DivinerLiveSymbol();
|
|
}
|
|
|
|
protected function buildAbstractDocumentByPHID($phid) {
|
|
$atom = $this->loadDocumentByPHID($phid);
|
|
$book = $atom->getBook();
|
|
|
|
if (!$atom->getIsDocumentable()) {
|
|
return null;
|
|
}
|
|
|
|
$doc = $this->newDocument($phid)
|
|
->setDocumentTitle($atom->getTitle())
|
|
->setDocumentCreated($book->getDateCreated())
|
|
->setDocumentModified($book->getDateModified());
|
|
|
|
$doc->addField(
|
|
PhabricatorSearchDocumentFieldType::FIELD_BODY,
|
|
$atom->getSummary());
|
|
|
|
$doc->addRelationship(
|
|
PhabricatorSearchRelationship::RELATIONSHIP_BOOK,
|
|
$atom->getBookPHID(),
|
|
DivinerBookPHIDType::TYPECONST,
|
|
$book->getDateCreated());
|
|
|
|
return $doc;
|
|
}
|
|
|
|
}
|