List of usage examples for org.apache.mahout.cf.taste.impl.model.mongodb MongoDBDataModel refreshData
public void refreshData(String userID, Iterable<List<String>> items, boolean add) throws NoSuchUserException, NoSuchItemException
Adds/removes (user, item) pairs to/from the model.
From source file:com.aguin.stock.recommender.WriteUserInfo.java
License:Apache License
public void writeToDB() { MongoDBDataModel md = MongoDBUserModel.instance(); Collection<List<String>> items = Lists.newArrayList(); List<String> it = Lists.newArrayList(); it.add(item);// w w w. ja v a 2 s .c o m it.add(pref); items.add(it); try { System.out.println("Refreshing database\n"); md.refreshData(user, items, true); } catch (NoSuchUserException e) { System.out.println(e.toString()); e.printStackTrace(); } catch (NoSuchItemException e) { System.out.println(e.toString()); e.printStackTrace(); } }