Hi,
I am working with Ripple[1] under Ruby on Rails[2] and my problem is that
I don't know how to order results that I get with Ripple. I know that there
is only two ways in this circunstance, one is using Erlang and another using
Javascript, but I'd like to try to implement this javascript code. The
problems are the next for me(I've started with Riak a mount ago),
a) How do I make a sort function using javascript inside MapReduce? is there
any example that somebody can share about how to code it in javascript?
b) Where is it write in Ruby on Rails structure? is it a code to write
inside one of the next files
"app/mapreduce/contrib.js" or "app/mapreduce/ripple.js" or do I have to make
a new file to this special order functions?
c) I am using this code line to get elements inside action controllers of
Ruby on Rails app:
Riak::MapReduce.new(client).search("posts", query).map("Riak.mapValuesJson",
:keep => true).run
Where I would have to call my new javascript sort function inside this line?
¿should I have to add a new part to this like next example?
Riak::MapReduce.new(client).search('posts', 'text:fake').map("function(v){
return [JSON.parse(v.values[0].data).text]; }", :keep =>
true).reduce('Contrib.sort', { by: 'ts', order: 'asc' }).run
Well, I hope to be clear in my questions.
Greetings!
Cesar
--------------------------------------------------------------
LinkedIn : http://www.linkedin.com/in/cesardiaz
[1] : gem 'ripple', :git => "git://github.com/seancribbs/ripple.git" (in
Gemfile)
[2] : Ruby on Rails 3.1.3
--
View this message in context:
http://riak-users.197444.n3.nabble.com/How-can-I-sort-results-with-javascript-functions-under-Rails-using-Ripple-tp3750029p3750029.html
Sent from the Riak Users mailing list archive at Nabble.com.
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com