Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F972913
PonderSearchIndexer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
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
(
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
Details
Attached
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)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment