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