Example usage for org.apache.mahout.cf.taste.impl.model.mongodb MongoDBDataModel refreshData

List of usage examples for org.apache.mahout.cf.taste.impl.model.mongodb MongoDBDataModel refreshData

Introduction

In this page you can find the example usage for org.apache.mahout.cf.taste.impl.model.mongodb MongoDBDataModel refreshData.

Prototype

public void refreshData(String userID, Iterable<List<String>> items, boolean add)
        throws NoSuchUserException, NoSuchItemException 

Source Link

Document

Adds/removes (user, item) pairs to/from the model.

Usage

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();
    }
}