示例#1
0
 public function __construct(SearchQueryObjectBuilder $builder)
 {
     parent::__construct($builder->getObjectID());
     $this->initiatingGID = $builder->getinitiatingGID();
     $this->query = $builder->getQuery();
     $this->hopCount = $builder->getHopCount();
     $this->datetime = $builder->getDatetime();
     $this->signature = $builder->getSignature();
 }
示例#2
0
 public function testSearch()
 {
     $searchQuery = (new SearchQueryObjectBuilder())->initiatingGID(Sonic::getContextGlobalID())->query((new ESQueryBuilder())->type('profile')->match('displayName', 'alice')->build())->datetime()->build();
     $this->assertTrue($searchQuery->validate());
     $this->assertEquals($searchQuery, SearchQueryObjectBuilder::buildFromJSON($searchQuery->getJSONString()));
     $profile = (new ProfileObjectBuilder())->globalID(Sonic::getContextGlobalID())->displayName($this->aliceSocialRecord->getDisplayName())->param('x', 'y')->build();
     $searchResult = (new SearchResultObjectBuilder())->targetID($searchQuery->getObjectID())->resultOwnerGID($profile->getGlobalID())->resultObjectID($profile->getObjectID())->resultIndex($searchQuery->getQuery()->getIndex())->resultType($searchQuery->getQuery()->getType())->displayName($profile->getDisplayName())->datetime()->build();
     $this->assertTrue($searchResult->validate());
     $this->assertEquals($searchResult, SearchResultObjectBuilder::buildFromJSON($searchResult->getJSONString()));
     $searchResultCollection = (new SearchResultCollectionObjectBuilder())->objectID(UOID::createUOID($this->platformSocialRecord->getGlobalID()))->targetID($searchQuery->getObjectID())->platformGID($this->platformSocialRecord->getGlobalID())->datetime()->result($searchResult)->build();
     $this->assertTrue($searchResultCollection->validate());
     $this->assertEquals($searchResultCollection, SearchResultCollectionObjectBuilder::buildFromJSON($searchResultCollection->getJSONString()));
 }