setViewer($this->getViewer()) ->withObjectPHIDs(array($object->getPHID())) ->withComments(true) ->needComments(true) ->execute(); foreach ($xactions as $xaction) { if (!$xaction->hasComment()) { continue; } $comment = $xaction->getComment(); $document->addField( PhabricatorSearchDocumentFieldType::FIELD_COMMENT, $comment->getContent()); } } }