From Riak docs:
Riak Search is enabled in the app.config file. Simply change the setting to “true” in Riak Search Config section (shown below).
%% Riak Search Config
| allin = True | |
| present = ["harry", "bob", "nancy"] | |
| required = ["bob","harry","fred"] | |
| for x in required: | |
| if x not in present: | |
| allin = False |
| query = riakclient.add('products') | |
| query.map(""" | |
| function(v, arg) { | |
| var data = JSON.parse(v.values[0].data); | |
| if(data.category == arg.category) { | |
| return [[v.key, arg.category]]; | |
| } else { | |
| return []; | |
| } | |
| }""", {"category":"food"}) |
| { | |
| "5af5c2c8144a11e28f9f001c14010046": { | |
| "category": "clothing", | |
| "available": 20, | |
| "pricefrom": 180.0, | |
| "title": "2-Pack Heart Top", | |
| "created": 1350032036, | |
| "lastUpdated": 1351691717 | |
| } | |
| }, |
From Riak docs:
Riak Search is enabled in the app.config file. Simply change the setting to “true” in Riak Search Config section (shown below).
%% Riak Search Config
| # | |
| # Cookbook Name:: wcl-vumi-go | |
| # Recipe:: default | |
| # | |
| # Copyright 2013, Western Cape Labs | |
| # | |
| # Licensed 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 | |
| # |
| DEFAULT: | |
| {storage_backend, riak_kv_bitcask_backend}, | |
| CHANGE TO: | |
| {storage_backend, riak_kv_eleveldb_backend}, | |
| DEFAULT: | |
| %% Riak Search Config | |
| {riak_search, [ | |
| %% To enable Search functionality set this 'true'. |
| Vagrant::Config.run do |config| | |
| config.vm.box = "precise64" | |
| # Port forwarding | |
| ## Nginx | |
| #config.vm.forward_port 8080, 8080 | |
| ## shares | |
| # change ../code/vumi-go to whereever your clone of vumi-go is locatated |
Author: Mike Jones
All bad practices and advice is entirely the fault of the author
These notes are in addition to these
Github repo
| from twisted.internet.defer import inlineCallbacks, returnValue | |
| from vumi.application import ApplicationWorker | |
| from vumi.persist.txredis_manager import TxRedisManager | |
| from vumi.config import ConfigDict | |
| class SmitterApplicationConfig(ApplicationWorker.CONFIG_CLASS): | |
| redis_manager = ConfigDict( | |
| "Redis client configuration.", default={}, static=True) |
| choices = ["totes", "cool", "NSFW", "awesome"] | |
| count = 0 | |
| for choice in choices: | |
| count +=1 | |
| if count == 1: | |
| print "I'm the first" | |
| elif count == len(choices): | |
| print "I'm the last" | |
| else: | |
| print "I'm in the middle somewhere" |