Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F111986408
PonderSearchIndexer.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
Tue, May 6, 12:54
Size
1 KB
Mime Type
text/x-php
Expires
Thu, May 8, 12:54 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25972749
Attached To
rPH Phabricator
PonderSearchIndexer.php
View Options
<?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
(
PhabricatorSearchDocumentFieldType
::
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
(
PhabricatorSearchDocumentFieldType
::
FIELD_COMMENT
,
$answer
->
getContent
());
}
}
$this
->
indexTransactions
(
$doc
,
new
PonderQuestionTransactionQuery
(),
array
(
$phid
));
$this
->
indexTransactions
(
$doc
,
new
PonderAnswerTransactionQuery
(),
mpull
(
$answers
,
'getPHID'
));
return
$doc
;
}
}
Event Timeline
Log In to Comment