grahamjenson / hapiger

HapiGer is an http-wrapper around the Good Enough Recommendation engine using the Hapi.js framework
174 stars 36 forks source link

non in-memory ES doesnt return recommendations #15

Open baderth opened 7 years ago

baderth commented 7 years ago

Started out with the default in-memory option, everything went fine as expected. Tried recommended pgsql for persistence afterwards, very same data set, import went fine.

Same query as with in-memory didnt return anything. So i gave mysql a shot, same behaviour, import fine, recommendation response is always empty.

any hints on what i might be missing?

grahamjenson commented 7 years ago

Not sure what the issue is. It might be the expires_at date working differently, but cant be certain. Could you post a short script with a few events to demonstrate the issue?

baderth commented 7 years ago

import script attached (hapiger.txt). mysql table resulted in:

_CREATE TABLE events ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, person VARCHAR(255) NOT NULL, action VARCHAR(255) NOT NULL, thing VARCHAR(255) NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, expires_at TIMESTAMP NULL DEFAULT NULL, PRIMARY KEY (id) ) COLLATE='utf8_general_ci' ENGINE=MyISAM AUTOINCREMENT=3959;

"expires_at" data is always NULL.

Sample recommendation request with empty response: curl -X POST 'http://localhost:3456/recommendations' -d '{ "namespace": "materials", "thing": "ERISTOFF Barmatte Graffiti", "configuration": { "actions" : {"buy": 10} } }' hapiger.txt

aleczadikian commented 6 years ago

Same here, unless I set expires_at to some date in the future. expires_at is null in the database if I don't specify. SQL has the sometimes unintuitive behavior of having all comparisons to null return false, so maybe somewhere it isn't properly checking for null.

grahamjenson commented 6 years ago

This might be the case, a work around would be to set expires at to some time in the distant future, e.g. 3018. I suggest always using a expires_at date just so that data is always fresh, even if the date is years in advance.