Page MenuHomePhorge

PonderSearchIndexer.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

PonderSearchIndexer.php

<?php
final class PonderSearchIndexer
extends PhabricatorSearchDocumentIndexer {
public function getIndexableObject() {
return new PonderQuestion();
}
protected function buildAbstractDocumentByPHID($phid) {
$question = $this->loadDocumentByPHID($phid);
$doc = $this->newDocument($phid)
->setDocumentTitle($question->getTitle())
->setDocumentCreated($question->getDateCreated())
->setDocumentModified($question->getDateModified());
$doc->addField(
PhabricatorSearchField::FIELD_BODY,
$question->getContent());
$doc->addRelationship(
PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
$question->getAuthorPHID(),
PhabricatorPeopleUserPHIDType::TYPECONST,
$question->getDateCreated());
$answers = id(new PonderAnswerQuery())
->setViewer($this->getViewer())
->withQuestionIDs(array($question->getID()))
->execute();
foreach ($answers as $answer) {
if (strlen($answer->getContent())) {
$doc->addField(
PhabricatorSearchField::FIELD_COMMENT,
$answer->getContent());
}
}
$this->indexTransactions(
$doc,
new PonderQuestionTransactionQuery(),
array($phid));
$this->indexTransactions(
$doc,
new PonderAnswerTransactionQuery(),
mpull($answers, 'getPHID'));
return $doc;
}
}

File Metadata

Mime Type
text/x-php
Expires
Wed, Jun 18, 6:29 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
225069
Default Alt Text
PonderSearchIndexer.php (1 KB)

Event Timeline