@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 PhrictionDocumentFulltextEngine
4 extends PhabricatorFulltextEngine {
5
6 protected function buildAbstractDocument(
7 PhabricatorSearchAbstractDocument $document,
8 $object) {
9
10 $wiki = id(new PhrictionDocumentQuery())
11 ->setViewer($this->getViewer())
12 ->withPHIDs(array($document->getPHID()))
13 ->needContent(true)
14 ->executeOne();
15
16 $content = $wiki->getContent();
17
18 $document->setDocumentTitle($content->getTitle());
19
20 // TODO: These are not quite correct, but we don't currently store the
21 // proper dates in a way that's easy to get to.
22 $document
23 ->setDocumentCreated($content->getDateCreated())
24 ->setDocumentModified($content->getDateModified());
25
26 $document->addField(
27 PhabricatorSearchDocumentFieldType::FIELD_BODY,
28 $content->getContent());
29
30 $document->addRelationship(
31 PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
32 $content->getAuthorPHID(),
33 PhabricatorPeopleUserPHIDType::TYPECONST,
34 $content->getDateCreated());
35
36 $document->addRelationship(
37 ($wiki->getStatus() == PhrictionDocumentStatus::STATUS_EXISTS)
38 ? PhabricatorSearchRelationship::RELATIONSHIP_OPEN
39 : PhabricatorSearchRelationship::RELATIONSHIP_CLOSED,
40 $wiki->getPHID(),
41 PhrictionDocumentPHIDType::TYPECONST,
42 PhabricatorTime::getNow());
43 }
44}