Example #1
0
 public function test()
 {
     $esquery = (new ESQueryBuilder())->type('test')->build();
     $esquery->setMatch('a', 'b');
     // serialization // creation from string
     $this->assertEquals($esquery, ESQueryBuilder::buildFromJSON($esquery->getJSONString()));
 }
 public static function buildFromJSON($json)
 {
     // TODO parse and verify json
     $jsonObject = json_decode($json);
     $signature = SignatureObject::createFromJSON(json_encode($jsonObject->signature));
     return (new SearchQueryObjectBuilder())->objectID($jsonObject->objectID)->initiatingGID($jsonObject->initiatingGID)->query(ESQueryBuilder::buildFromJSON(json_encode($jsonObject->query)))->hopCount($jsonObject->hopCount)->datetime($jsonObject->datetime)->signature($signature)->build();
 }
Example #3
0
 public function __construct(ESQueryBuilder $builder)
 {
     $this->index = $builder->getIndex();
     $this->type = $builder->getType();
     $this->query = $builder->getQuery();
 }