Skip to content

Instantly share code, notes, and snippets.

@coderoshi
Created September 3, 2014 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderoshi/a12e30e4c4c152ec6e41 to your computer and use it in GitHub Desktop.
Save coderoshi/a12e30e4c4c152ec6e41 to your computer and use it in GitHub Desktop.
# encoding: UTF-8
require 'riak'
require 'rsolr'
require 'ap'
client = Riak::Client.new(nodes: [{pb_port:10017}])
people = client.bucket('people')
map = Riak::Crdt::Map.new(people, 'eric', 'maps')
map.registers['first'] = 'MY_NAME'
map.registers['phone'] = '5551234567'
ap map.registers['first_name']
# solr = RSolr.connect(url: 'http://localhost:10018/solr/people')
# resp = solr.get('select', params:{q:'first_register:MY_NAME', fl:'first_register,phone_register'})
# ap resp["response"]["docs"].first
@coderoshi
Copy link
Author

curl -XPUT http://localhost:10018/search/index/people

riak-admin bucket-type create maps '{"props":{"datatype":"map"}}'

curl -XPUT http://localhost:10018/types/maps/buckets/people/props -H'Content-Type:application/json' -d'{"props":{"search_index":"people"}}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment