Created
December 19, 2012 07:56
-
-
Save arifsetiawan/4335145 to your computer and use it in GitHub Desktop.
riak-js search
This file contains hidden or 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
db.saveBucket('textr', {search: true}) | |
db.save('textr', 'text-00001', 'Riak Search is a distributed, full-text search engine that is built on Riak Core and included as part of Riak open source. Search provides the most advanced query capability next to MapReduce, but is far more concise; easier to use, and in most cases puts far less load on the cluster.') | |
db.save('textr', 'text-00002', 'Search indexes Riak KV objects as theyre written using a precommit hook. Based on the object’s mime type and the Search schema you’ve set for its bucket, the hook will automatically extract and analyze your data and build indexes from it. The Riak Client API is used to invoke Search queries that return a list of bucket/key pairs matching the query. Currently the PHP, Python, Ruby, and Erlang client libraries support integration with Riak Search.') | |
db.save('textr', 'text-00003', 'When collecting, parsing, and storing data like user bios, blog posts, journal articles, etc. to facilitate fast and accurate information retrieval in addition to some reasonable form of ranking.') | |
db.save('textr', 'text-00004', 'When Search is enabled on your Riak cluster, another set of vnodes, equal to the number of KV vnodes, will be started which will be used to handle Search requests. Search is enabled on a per-bucket basis by setting the search property to true. If search is enabled for a bucket, indexes are generated on all objects as they are written to it using the pre-commit hook. Index data stored on Search vnodes is replicated across the cluster using the same general mechanism as Riak KV, but using timestamps rather than vector clocks to increase performance.') | |
db.get('textr', 'text-00001', function(err, text, meta) { | |
console.log(text); | |
}) | |
db.get('textr', 'text-00002', function(err, text, meta) { | |
console.log(text); | |
}) | |
db.get('textr', 'text-00003', function(err, text, meta) { | |
console.log(text); | |
}) | |
db.get('textr', 'text-00004', function(err, text, meta) { | |
console.log(text); | |
}) | |
db.search.find('textr', 'indexes', function(err, data, meta) { | |
console.log(JSON.stringify(data)); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment