+

Search Tips   |   Advanced Search

Filtering LikeMinds recommendations

When LikeMinds makes recommendations, it can make the recommendations based on all items in the resource collection, or it can limit the predictions to only items that have certain characteristics.

Tell LikeMinds about an item by including key/value pairs describing its characteristics as you log actions and ratings that occur against it. The format for the key/value pair is

Key = LMFilter.<item_characteristic>
value = <value>

For example, to tell LikeMinds that an item's color is blue, and its category is sports, you would add the 2 key/value pairs:

LMFilter.color,blue
LMFilter.category,sports

Specify which characteristics you want LikeMinds to use in making predictions by setting request attributes in the RequestContext object immediately before the content spot containing the LikeMinds rule. To specify characteristics for filtering, do the following:

For example, to return predictions only from among items whose category is "clearance" and season is "spring" or "summer", you would add the following code before the content spot:

com.ibm.websphere.personalization.RequestContext.context =
com.ibm.servlet.personalization.context.PersonalizationContext.getRequestContext(httpRequest);

context.setRequestAttribute("LMFilter", new String[] { "LMFilter.category", "LMFilter.season" });

context.setRequestAttribute("LMFilter.category", "clearance");

context.setRequestAttribute("LMFilter.season", new String[] { "spring", "summer" });

To return predictions only from items whose color is blue, you would add the following code before the content spot:

com.ibm.websphere.personalization.RequestContext.context =
com.ibm.servlet.personalization.context.PersonalizationContext.getRequestContext(httpRequest);

context.setRequestAttribute("LMFilter", "LMFilter.color");

context.setRequestAttribute("LMFilter.color", "blue");


Parent: LikeMinds Recommendations