public abstract class ItemSelector
extends java.lang.Object
Select items for use in recommendation or
Modifier and Type | Class and Description |
---|---|
static class |
ItemSelector.GroovyItemSelector
Item selector based on a Groovy script.
|
static class |
ItemSelector.ItemSelectScript
Base class defining the environment in which item selectors are evaluated.
|
Constructor and Description |
---|
ItemSelector() |
Modifier and Type | Method and Description |
---|---|
static ItemSelector |
allItems() |
static ItemSelector |
compileSelector(java.lang.String expr)
Compile an item selector from a Groovy expression.
|
static ItemSelector |
fixed(long... items) |
static ItemSelector |
fixed(LongSet items)
Get an item selector that returns a fixed set of items.
|
static ItemSelector |
nullSelector()
Get an item selector that returns null.
|
abstract LongSet |
selectItems(LongSet universe,
Recommender recommender,
TestUser user)
Select a set of items for recommendation.
|
static ItemSelector |
userTestItems() |
static ItemSelector |
userTrainItems() |
public abstract LongSet selectItems(LongSet universe, Recommender recommender, TestUser user)
Select a set of items for recommendation.
universe
- The universe of all items.recommender
- The recommender, in case additional information is needed form it.user
- The user being tested.public static ItemSelector nullSelector()
Get an item selector that returns null. When used as the set of candidate items, this will select the default candidate set.
null
.public static ItemSelector fixed(LongSet items)
Get an item selector that returns a fixed set of items.
items
- The items to return.public static ItemSelector fixed(long... items)
public static ItemSelector compileSelector(java.lang.String expr)
Compile an item selector from a Groovy expression. Two useful objects are available to this expression:
TestUser
.The expression is compiled as a script with a base class of ItemSelector.ItemSelectScript
; see that for more details.
expr
- A Groovy expression. Can be null
, in which case nullSelector()
is returned.public static ItemSelector allItems()
public static ItemSelector userTestItems()
public static ItemSelector userTrainItems()