Search code examples
mahoutmyrrix

How to insert String user IDs via REST API in Myrrix Serving Layer


I have user IDs like a6347324, b7432408, f54789922 (non-numeric), and numeric item IDs. I want to able to use the REST API in Myrrix to insert such user-item pairs. But /pref/a6347324/1234 returns an error. It is expected, considering the parseLong in line 74 of https://github.com/myrrix/myrrix-recommender/blob/master/web-common/src/net/myrrix/web/servlets/PreferenceServlet.java

I am using version 0.11. I don't want to use the "tag" feature since it does not return the string tags like equivalent numeric IDs, and I don't think it will work with the because API (since tags are not returned!). Will there be a fix for this soon? Is there an immediate workaround that I can use or implement quickly?


Solution

  • The REST API itself works in terms of numeric IDs, by design. It's the client that potentially does hashing of some other ID -- numeric or not -- to make a numeric ID. You want to use TranslatingClientRecommender instead, which can help manage the translation back to original IDs.

    The added benefit is potentially some security; you need not actually send real user and item IDs to the service, which may be important if it is to be hosted on a third party cloud like Amazon EC2.