Last active
October 13, 2015 04:45
-
-
Save hiroeorz/10301bf9071cc1844d43 to your computer and use it in GitHub Desktop.
Riak2.0のSearch ref: http://qiita.com/hiroeorz@github/items/afd0a591dca3099bb40b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git clone https://github.com/basho/riak-ruby-client.git | |
$ cd riak-ruby-client | |
$ bundle install --path vendor/bundle | |
$ bundle exec irb | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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" | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ riak-admin bucket-type create animals '{"props": {}}' | |
$ riak-admin bucket-type activate animals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -XPUT http://localhost:8098/types/animals/buckets/cats/props \ | |
-H 'Content-Type:application/json' \ | |
-d '{"props": {"search_index": "famous"}}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ riak-admin bucket-type create animals '{"props": {"search_index":"famous"}}' | |
$ riak-admin bucket-type activate animals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ client.create_search_index("famous") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ client.create_search_index("famous", "_yz_default") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"people_ss":["Ryan", "Eric", "Brett"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
search = on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment