Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F119699086
PhrictionSearchIndexer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jun 28, 17:01
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jun 30, 17:01 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27062647
Attached To
rPH Phabricator
PhrictionSearchIndexer.php
View Options
<?php
/**
* @group phriction
*/
final
class
PhrictionSearchIndexer
extends
PhabricatorSearchDocumentIndexer
{
public
function
getIndexableObject
()
{
return
new
PhrictionDocument
();
}
protected
function
buildAbstractDocumentByPHID
(
$phid
)
{
$document
=
$this
->
loadDocumentByPHID
(
$phid
);
$content
=
id
(
new
PhrictionContent
())->
load
(
$document
->
getContentID
());
$document
->
attachContent
(
$content
);
$content
=
$document
->
getContent
();
$doc
=
new
PhabricatorSearchAbstractDocument
();
$doc
->
setPHID
(
$document
->
getPHID
());
$doc
->
setDocumentType
(
PhrictionPHIDTypeDocument
::
TYPECONST
);
$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
(),
PhabricatorPeoplePHIDTypeUser
::
TYPECONST
,
$content
->
getDateCreated
());
if
(
$document
->
getStatus
()
==
PhrictionDocumentStatus
::
STATUS_EXISTS
)
{
$doc
->
addRelationship
(
PhabricatorSearchRelationship
::
RELATIONSHIP_OPEN
,
$document
->
getPHID
(),
PhrictionPHIDTypeDocument
::
TYPECONST
,
time
());
}
return
$doc
;
}
}
Event Timeline
Log In to Comment