Skip to content

Instantly share code, notes, and snippets.

@hiroeorz
Last active October 13, 2015 04:45
Show Gist options
  • Save hiroeorz/10301bf9071cc1844d43 to your computer and use it in GitHub Desktop.
Save hiroeorz/10301bf9071cc1844d43 to your computer and use it in GitHub Desktop.
$ git clone https://github.com/basho/riak-ruby-client.git
$ cd riak-ruby-client
$ bundle install --path vendor/bundle
$ bundle exec irb
>
{"max_score"=>2.3246877193450928,
"num_found"=>1,
"docs"=>[{"score"=>"2.32468770000000013454e+00",
"_yz_rb"=>"cats",
"_yz_rt"=>"animals",
"_yz_rk"=>"liono",
"_yz_id"=>"1*animals*cats*liono*10",
"name_s"=>"Lion-o", "age_i"=>"30", "leader_b"=>"true"
}]
}
$ riak-admin bucket-type create animals '{"props": {}}'
$ riak-admin bucket-type activate animals
$ curl -XPUT http://localhost:8098/types/animals/buckets/cats/props \
-H 'Content-Type:application/json' \
-d '{"props": {"search_index": "famous"}}'
$ riak-admin bucket-type create animals '{"props": {"search_index":"famous"}}'
$ riak-admin bucket-type activate animals
$ client.create_search_index("famous")
$ client.create_search_index("famous", "_yz_default")
results
{"max_score"=>2.3246877193450928,
"num_found"=>1,
"docs"=>[{"score"=>"2.32468770000000013454e+00",
"_yz_rb"=>"cats",
"_yz_rt"=>"animals",
"_yz_rk"=>"liono",
"_yz_id"=>"1*animals*cats*liono*10",
"name_s"=>"Lion-o", "age_i"=>"30", "leader_b"=>"true"
}]
}
{"people_ss":["Ryan", "Eric", "Brett"]}
search = on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment