@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<?php
2
3final 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}