Hello, I'm new to the mailing list.I tried the similar product example,
although raw http method works, the java sdk method dosen't return any
result, and this INFO pops : [ALSAlgorithm] No productFeatures vector for
query items List(i1).
This the code:
Recommender Class:
public class CourseRecommender {
public static void main(String[] args) throws Exception {
EngineClient engineClient = null;
try {
engineClient = new EngineClient("http://localhost:8000");
JsonObject response =
engineClient.sendQuery(ImmutableMap.<String, Object>of(
"items", ImmutableList.of("i1"),
"num", 4));
System.out.println(response);
} finally {
engineClient.close();
}
}
}
Data Insertion Class:
public class DataInserter {
private static final String API_KEY =
"uk8t-3o7n1Fd0A0NOjyRjfJIb1oki8ymxAjZdXpfOQwQgS_2N8zHJTueypahBtIz";
private static final String SERVER_URL = "http://localhost:7070";
public static void main(String[] args) throws Exception {
EventClient client = null;
try {
client = new EventClient(API_KEY, SERVER_URL);
Event userEvent = new Event()
.event("$set")
.entityType("user")
.entityId("u0")
.property("prop0", "value");
Event userEvent2 = new Event()
.event("$set")
.entityType("user")
.entityId("u1")
.property("prop1", "value");
Event userEvent3 = new Event()
.event("$set")
.entityType("user")
.entityId("u2")
.property("prop2", "value");
client.createEvent(userEvent);
client.createEvent(userEvent2);
client.createEvent(userEvent3);
Event itemEvent = new Event()
.event("$set")
.entityType("item")
.entityId("i0")
.property("categories", ImmutableList.of("IT_Courses"));
Event itemEvent2 = new Event()
.event("$set")
.entityType("item")
.entityId("i1")
.property("categories",
ImmutableList.of("Telecom_Courses"));
Event itemEvent3 = new Event()
.event("$set")
.entityType("item")
.entityId("i2")
.property("categories",
ImmutableList.of("IT_Courses", "Telecom_Courses"));
client.createEvent(itemEvent);
client.createEvent(itemEvent2);
client.createEvent(itemEvent3);
Event viewEvent = new Event()
.event("view")
.entityType("user")
.entityId("u0")
.targetEntityType("item")
.targetEntityId("i0");
client.createEvent(viewEvent);
Event viewEvent2 = new Event()
.event("view")
.entityType("user")
.entityId("u1")
.targetEntityType("item")
.targetEntityId("i0");
client.createEvent(viewEvent2);
System.out.println(viewEvent);
System.out.println(viewEvent2);
System.out.println("Events Created Successfully");
} catch (Exception e) {
e.printStackTrace();
}
finally {
client.close();
}
}
}
Any help would be very appreciated.