Skip to content

Instantly share code, notes, and snippets.

// This file is provided to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// This file is provided to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
function returnPosts(postKeys, req, res){
//sys.puts('postKeys:' + postKeys);
var inputs = [];
for (var i=0;i < postKeys.length;i++){
var bk = ["posts", postKeys[i].toString() ];
//sys.puts('bk: '+bk);
inputs.push(bk);
git clone http://github.com/basho/riak.git
cd riak
make all
make rel
rel/riak/bin/riak start
function returnPosts(postKeys, req, res){
//init empty inputs array
var inputs = [];
//postKeys is a list of riak keys. loop over them
for (var i=0;i < postKeys.length;i++){
//bk (bucket/key) is created as it's own array of two
//strings ["bucket","key"] (i use a "posts" bucket in my app)
var bk = ["posts", postKeys[i].toString() ];
//bk array is pushed onto the inputs array
util = {
getTags: function() {
var ret = ["one","two","three"];
return ret.sort();
},
//check a tag against the main tag list
checkSubmittedTag: function(submittedTag) {
sys.log('checking : ' + submittedTag);
8 Sep 05:08:38 - getfiltertags. submitted tags: one,two,test fail tag , 3
8 Sep 05:08:38 - checking : one
8 Sep 05:08:38 - getfiltertags. vetted tags: , length : 1
//check a tag against the main tag list
checkSubmittedTag: function(submittedTag) {
//sys.log('checking : ' + submittedTag);
var origTags = this.getTags(tags);
//sys.log('origtags: ' + origTags);
//return 0 ;
//if ( origTags.search(submittedTag) > 0 ) return 1 ;
Yoni: hi there?
Alexander: dude ! how goes . shana tova
Yoni: not too good here
Alexander: whats wrong ?
Yoni: my Fam and I are stranded in England
//save the object with no key in riak. riak will autogen a key
riak.save('posts','',{content: content, tags: vettedPostTags })(
//success callback
function (d,m){
//return an int of lastmodified in meta
var paresedDate = Date.parse(m.headers.date);
//push riak key to a mostrecents list in redis