@Test public void testMultiMostSimilarItemsRescorer() { RescorerProvider multi = new MultiRescorerProvider(new SimpleModRescorerProvider(2), new SimpleModRescorerProvider(3)); PairRescorer provider = multi.getMostSimilarItemsRescorer(null); assertNotNull(provider); assertTrue(provider instanceof MultiLongPairRescorer); assertTrue(provider.isFiltered("AB", "ABC")); assertTrue(provider.isFiltered("AB", "ABCDEF")); assertFalse(provider.isFiltered("ABCDEF", "ABCDEFABCDEF")); }
@Override public PairRescorer getMostSimilarItemsRescorer(OryxRecommender recommender, String... args) { List<PairRescorer> rescorers = Lists.newArrayListWithCapacity(providers.length); for (RescorerProvider provider : providers) { PairRescorer rescorer = provider.getMostSimilarItemsRescorer(recommender, args); if (rescorer != null) { rescorers.add(rescorer); } } int numRescorers = rescorers.size(); if (numRescorers == 0) { return null; } if (numRescorers == 1) { return rescorers.get(0); } return new MultiLongPairRescorer(rescorers); }
MultiRescorerProvider extends AbstractRescorerProvider { @Override public PairRescorer getMostSimilarItemsRescorer(OryxRecommender recommender, String... args) { List<PairRescorer> rescorers = Lists.newArrayListWithCapacity(providers.length); for (RescorerProvider provider : providers) { PairRescorer rescorer = provider.getMostSimilarItemsRescorer(recommender, args); if (rescorer != null) { rescorers.add(rescorer); } } int numRescorers = rescorers.size(); if (numRescorers == 0) { return null; } if (numRescorers == 1) { return rescorers.get(0); } return new MultiLongPairRescorer(rescorers); } }
MultiRescorerProvider extends AbstractRescorerProvider { @Override public PairRescorer getMostSimilarItemsRescorer(OryxRecommender recommender, String... args) { List<PairRescorer> rescorers = Lists.newArrayListWithCapacity(providers.length); for (RescorerProvider provider : providers) { PairRescorer rescorer = provider.getMostSimilarItemsRescorer(recommender, args); if (rescorer != null) { rescorers.add(rescorer); } } int numRescorers = rescorers.size(); if (numRescorers == 0) { return null; } if (numRescorers == 1) { return rescorers.get(0); } return new MultiLongPairRescorer(rescorers); } MultiRescorerProvider(RescorerProvider... providers);  MultiRescorerProvider(List<RescorerProvider> providers); }
MultiRescorerProvider extends AbstractRescorerProvider { @Override public PairRescorer getMostSimilarItemsRescorer(OryxRecommender recommender, String... args) { List<PairRescorer> rescorers = Lists.newArrayListWithCapacity(providers.length); for (RescorerProvider provider : providers) { PairRescorer rescorer = provider.getMostSimilarItemsRescorer(recommender, args); if (rescorer != null) { rescorers.add(rescorer); } } int numRescorers = rescorers.size(); if (numRescorers == 0) { return null; } if (numRescorers == 1) { return rescorers.get(0); } return new MultiLongPairRescorer(rescorers); } MultiRescorerProvider(RescorerProvider... providers);  MultiRescorerProvider(List<RescorerProvider> providers); @Override Rescorer getRecommendRescorer(String[] userIDs, OryxRecommender recommender, String... args); @Override Rescorer getRecommendToAnonymousRescorer(String[] itemIDs, OryxRecommender recommender, String... args); @Override Rescorer getMostPopularItemsRescorer(OryxRecommender recommender, String... args); @Override PairRescorer getMostSimilarItemsRescorer(OryxRecommender recommender, String... args); }
MultiRescorerProvider extends AbstractRescorerProvider { @Override public PairRescorer getMostSimilarItemsRescorer(OryxRecommender recommender, String... args) { List<PairRescorer> rescorers = Lists.newArrayListWithCapacity(providers.length); for (RescorerProvider provider : providers) { PairRescorer rescorer = provider.getMostSimilarItemsRescorer(recommender, args); if (rescorer != null) { rescorers.add(rescorer); } } int numRescorers = rescorers.size(); if (numRescorers == 0) { return null; } if (numRescorers == 1) { return rescorers.get(0); } return new MultiLongPairRescorer(rescorers); } MultiRescorerProvider(RescorerProvider... providers);  MultiRescorerProvider(List<RescorerProvider> providers); @Override Rescorer getRecommendRescorer(String[] userIDs, OryxRecommender recommender, String... args); @Override Rescorer getRecommendToAnonymousRescorer(String[] itemIDs, OryxRecommender recommender, String... args); @Override Rescorer getMostPopularItemsRescorer(OryxRecommender recommender, String... args); @Override PairRescorer getMostSimilarItemsRescorer(OryxRecommender recommender, String... args);  }