2011-07-12 02:29:08 +02:00
|
|
|
<?php
|
|
|
|
|
2011-09-14 17:02:31 +02:00
|
|
|
/**
|
|
|
|
* @group search
|
|
|
|
*/
|
2012-03-14 00:21:04 +01:00
|
|
|
final class PhabricatorSearchPhrictionIndexer
|
2011-07-12 02:29:08 +02:00
|
|
|
extends PhabricatorSearchDocumentIndexer {
|
|
|
|
|
|
|
|
public static function indexDocument(PhrictionDocument $document) {
|
|
|
|
$content = $document->getContent();
|
|
|
|
|
|
|
|
$doc = new PhabricatorSearchAbstractDocument();
|
|
|
|
$doc->setPHID($document->getPHID());
|
|
|
|
$doc->setDocumentType(PhabricatorPHIDConstants::PHID_TYPE_WIKI);
|
|
|
|
$doc->setDocumentTitle($content->getTitle());
|
|
|
|
|
|
|
|
// TODO: This isn't precisely correct, denormalize into the Document table?
|
|
|
|
$doc->setDocumentCreated($content->getDateCreated());
|
|
|
|
$doc->setDocumentModified($content->getDateModified());
|
|
|
|
|
|
|
|
$doc->addField(
|
|
|
|
PhabricatorSearchField::FIELD_BODY,
|
|
|
|
$content->getContent());
|
|
|
|
|
|
|
|
$doc->addRelationship(
|
|
|
|
PhabricatorSearchRelationship::RELATIONSHIP_AUTHOR,
|
|
|
|
$content->getAuthorPHID(),
|
|
|
|
PhabricatorPHIDConstants::PHID_TYPE_USER,
|
|
|
|
$content->getDateCreated());
|
|
|
|
|
2011-08-08 00:14:23 +02:00
|
|
|
self::reindexAbstractDocument($doc);
|
2011-07-12 02:29:08 +02:00
|
|
|
}
|
|
|
|
}
|