Implementations of this interface provide, optionally, objects that can be used to modify and influence the results of:
- {@link ServerRecommender#recommend(long,int)}
- {@link ServerRecommender#recommendToMany(long[],int,boolean,IDRescorer)}
- {@link ServerRecommender#recommendToAnonymous(long[],int,IDRescorer)}
- {@link ServerRecommender#mostSimilarItems(long,int,Rescorer)}
It is a means to inject business logic into the results of {@link ServerRecommender}.
Implementations of this class are factories. An implementation creates and configures an {@link IDRescorer}rescoring object and returns it for use in the context of one {@link ServerRecommender#recommend(long,int,IDRescorer)} method call. (A {@code Rescorer<LongPair>}is used for {@link ServerRecommender#mostSimilarItems(long,int,Rescorer)} since it operates on item IDpairs, but is otherwise analogous.) The {@link IDRescorer} then filters the candidatesrecommendations or most similar items by item ID ( {@link IDRescorer#isFiltered(long)}) or modifies the scores of item candidates that are not filtered ( {@link IDRescorer#rescore(long,double)}) based on the item ID and original score.
The factory methods, like {@link #getRecommendRescorer(long[],MyrrixRecommender,String)}, take optional {@code String} arguments. These are passed from the REST API, as a {@code String}, from URL parameter {@code rescorerParams}. The implementation may need this information to initialize its rescoring logic for the request. For example, the argument may be the user's current location, used to filter results by location.
For example, a request containing {@code ...?rescorerParams=xxx,yyy,zzz} will result in an {@code args}parameter with one elements, {@code xxx,yyy,zzz}. A request containing {@code ...?rescorerParams=xxx&...rescorerParams=yyy&...rescorerParams=zzz...} will result in an{@code args} parameter with 3 elements, {@code xxx}, {@code yyy}, {@code zzz}.
@author Sean Owen
@since 1.0
@see MultiRescorer
@see net.myrrix.online.candidate.CandidateFilter