Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/paste/engine/PhabricatorPasteFulltextEngine.php
13402 views
1
<?php
2
3
final class PhabricatorPasteFulltextEngine
4
extends PhabricatorFulltextEngine {
5
6
protected function buildAbstractDocument(
7
PhabricatorSearchAbstractDocument $document,
8
$object) {
9
10
$paste = id(new PhabricatorPasteQuery())
11
->setViewer($this->getViewer())
12
->withPHIDs(array($object->getPHID()))
13
->needContent(true)
14
->executeOne();
15
16
$document->setDocumentTitle($paste->getTitle());
17
18
$document->addRelationship(
19
$paste->isArchived()
20
? PhabricatorSearchRelationship::RELATIONSHIP_CLOSED
21
: PhabricatorSearchRelationship::RELATIONSHIP_OPEN,
22
$paste->getPHID(),
23
PhabricatorPastePastePHIDType::TYPECONST,
24
PhabricatorTime::getNow());
25
26
$document->addField(
27
PhabricatorSearchDocumentFieldType::FIELD_BODY,
28
$paste->getContent());
29
30
$document->addRelationship(
31
PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
32
$paste->getAuthorPHID(),
33
PhabricatorPeopleUserPHIDType::TYPECONST,
34
$paste->getDateCreated());
35
}
36
37
}
38
39