Hello, I am trying to use the MapReduce function that comes along with the
Java API. I am using this code:
try{
IRiakClient client = RiakFactory.pbcClient("192.168.0.41",
8087);
Bucket myBucket = client.fetchBucket("Productos").execute();
//Bucket called Productos
BucketMapReduce m = client.mapReduce("Productos");
m.addMapPhase(new NamedJSFunction("Riak.mapValuesJson"), true);
MapReduceResult result = m.execute();
//System.out.println(result.getResultRaw());
Collection<Producto> tmp = result.getResult(Producto.class);
for (Producto p : tmp) {
System.out.println(p.Nombre+"\n");
}
client.shutdown();
}
catch(Exception Ex){
System.out.println(Ex.getMessage());
}
I have a Producto Class like this:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.StringTokenizer;
import javax.swing.JFileChooser;
/**
*
* @author edwinfernandez
*/
public class Producto {
public String ID;
public String Nombre;
public String Descripcion;
public String Vendedor;
public String Url;
public String Precio;
public Producto(String id,String name,String desc,String seller,String
precio,String url){
ID = id;
Nombre = name;
Descripcion = desc;
Vendedor = seller;
Precio = precio;
Url = url;
}
public Producto(){
}
}
I can't seem to make it work, I just need to mapreduce the description of
each product in order to get the top ten most used words to describe
products.
Thank you in advance.
--
View this message in context:
http://riak-users.197444.n3.nabble.com/Riak-API-for-Java-tp4032055.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