You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dear everyone:
I follow the tutorial at http://docs.basho.com/riak/kv/2.1.4/developing/usage/document-store/ , Step by Step Practice , when I've Post a request for store object , but the riak server respond 400 (Bad Request) , I review my code again and again , but no problem found . see below:
_riak = $riak;
$this->_bucket = new Bucket($bucket, "cms");
$this->_location = new Riak\Location('blog1',$this->_bucket,"cms");
$this->_title = $title;
$this->_author = $author;
$this->_content = $content;
$this->_keywords = $keywords;
$this->_datePosted = $date;
$this->_published = $published;
}
public function store()
{
$setBuilder = (new UpdateSet($this->_riak));
```
foreach($this->_keywords as $keyword) {
$setBuilder->add($keyword);
}
```
/*
(new UpdateMap($this->_riak))
->updateRegister('title', $this->_title)
->updateRegister('author', $this->_author)
->updateRegister('content', $this->_content)
->updateRegister('date', $this->_datePosted)
->updateFlag('published', $this->_published)
->updateSet('keywords', $setBuilder)
->withBucket($this->_bucket)
->build()
->execute();
*/
$response = (new UpdateMap($this->_riak))
->updateRegister('title', $this->_title)
->updateRegister('author', $this->_author)
->updateRegister('content', $this->_content)
->updateRegister('date', $this->_datePosted)
->updateFlag('published', $this->_published)
->updateSet('keywords', $setBuilder)
->atLocation($this->_location)
->build()
->execute();
```
echo ' ';
var_dump($response);
echo ' ';
```
}
}
$node = (new Node\Builder)
->atHost('192.168.111.2')
->onPort(8098)
->build();
```
$riak = new Riak([$node]);
```
$keywords = ['adorbs', 'cheshire'];
$date = new \DateTime('now');
$post1 = new BlogPost(
$riak,
'cat_pics', // bucket
'This one is so lulz!', // title
'Cat Stevens', // author
'Please check out these cat pics!', // content
$keywords, // keywords
$date, // date posted
true // published
);
$post1->store();
the wireshark captured packet :
192.168.171.124(client ip) => 192.168.111.2(riak server ip) HTTP 511 POST /types/cms/buckets/cat_pics/datatypes/alldoc? HTTP/1.1 (application/json)
192.168.111.2 192.168.171.124 HTTP 251 HTTP/1.1 400 Bad Request
GET http://192.168.111.2:8098//types/cms/buckets/cat_pics/props
{"props":{"name":"cat_pics","young_vclock":20,"w":"quorum","small_vclock":50,"search_index":"blog_posts","rw":"quorum","r":"quorum","pw":0,"precommit":[],"pr":0,"postcommit":[],"old_vclock":86400,"notfound_ok":true,"n_val":3,"linkfun":{"mod":"riak_kv_wm_link_walker","fun":"mapreduce_linkfun"},"last_write_wins":false,"dw":"quorum","dvv_enabled":true,"chash_keyfun":{"mod":"riak_core_util","fun":"chash_std_keyfun"},"big_vclock":50,"basic_quorum":false,"allow_mult":true,"datatype":"map","active":true,"claimant":"node1@192.168.111.1"}}
```
please help me catch the bugs thanks in advance!
```
regards
The text was updated successfully, but these errors were encountered:
dear everyone:
_riak = $riak; $this->_bucket = new Bucket($bucket, "cms"); $this->_location = new Riak\Location('blog1',$this->_bucket,"cms"); $this->_title = $title; $this->_author = $author; $this->_content = $content; $this->_keywords = $keywords; $this->_datePosted = $date; $this->_published = $published; } public function store() { $setBuilder = (new UpdateSet($this->_riak)); ``` foreach($this->_keywords as $keyword) { $setBuilder->add($keyword); } ``` /* (new UpdateMap($this->_riak)) ->updateRegister('title', $this->_title) ->updateRegister('author', $this->_author) ->updateRegister('content', $this->_content) ->updateRegister('date', $this->_datePosted) ->updateFlag('published', $this->_published) ->updateSet('keywords', $setBuilder) ->withBucket($this->_bucket) ->build() ->execute(); */ $response = (new UpdateMap($this->_riak)) ->updateRegister('title', $this->_title) ->updateRegister('author', $this->_author) ->updateRegister('content', $this->_content) ->updateRegister('date', $this->_datePosted) ->updateFlag('published', $this->_published) ->updateSet('keywords', $setBuilder) ->atLocation($this->_location) ->build() ->execute(); ``` echo 'I follow the tutorial at http://docs.basho.com/riak/kv/2.1.4/developing/usage/document-store/ , Step by Step Practice , when I've Post a request for store object , but the riak server respond 400 (Bad Request) , I review my code again and again , but no problem found . see below:
'; var_dump($response); echo '
'; ``` } } $node = (new Node\Builder) ->atHost('192.168.111.2') ->onPort(8098) ->build(); ``` $riak = new Riak([$node]); ``` $keywords = ['adorbs', 'cheshire']; $date = new \DateTime('now'); $post1 = new BlogPost( $riak, 'cat_pics', // bucket 'This one is so lulz!', // title 'Cat Stevens', // author 'Please check out these cat pics!', // content $keywords, // keywords $date, // date posted true // published ); $post1->store(); the wireshark captured packet : 192.168.171.124(client ip) => 192.168.111.2(riak server ip) HTTP 511 POST /types/cms/buckets/cat_pics/datatypes/alldoc? HTTP/1.1 (application/json) 192.168.111.2 192.168.171.124 HTTP 251 HTTP/1.1 400 Bad Request GET http://192.168.111.2:8098//types/cms/buckets/cat_pics/props {"props":{"name":"cat_pics","young_vclock":20,"w":"quorum","small_vclock":50,"search_index":"blog_posts","rw":"quorum","r":"quorum","pw":0,"precommit":[],"pr":0,"postcommit":[],"old_vclock":86400,"notfound_ok":true,"n_val":3,"linkfun":{"mod":"riak_kv_wm_link_walker","fun":"mapreduce_linkfun"},"last_write_wins":false,"dw":"quorum","dvv_enabled":true,"chash_keyfun":{"mod":"riak_core_util","fun":"chash_std_keyfun"},"big_vclock":50,"basic_quorum":false,"allow_mult":true,"datatype":"map","active":true,"claimant":"node1@192.168.111.1"}} ``` please help me catch the bugs thanks in advance! ``` regards
The text was updated successfully, but these errors were encountered: