Skip to content

Commit 480620b

Browse files
committed
fix CurrentItemFilter bug
1 parent 40bd42d commit 480620b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

server/src/io/seldon/recommendation/filters/base/CurrentItemFilter.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
import io.seldon.clustering.recommender.RecommendationContext;
2727
import io.seldon.recommendation.ItemFilter;
2828

29-
import org.springframework.stereotype.Component;
30-
3129
import java.util.Collections;
3230
import java.util.List;
3331

32+
import org.springframework.stereotype.Component;
33+
3434
/**
3535
* Filter for the item that the user is currently interacting with.
3636
* @author firemanphil
@@ -42,7 +42,10 @@ public class CurrentItemFilter implements ItemFilter {
4242
@Override
4343
public List<Long> produceExcludedItems(String client, Long user, String clientUserId, RecommendationContext.OptionsHolder optsHolder,
4444
Long currentItem,String lastRecListUUID, int numRecommendations) {
45-
return Collections.singletonList(currentItem);
45+
if (currentItem != null)
46+
return Collections.singletonList(currentItem);
47+
else
48+
return Collections.emptyList();
4649
}
4750
}
4851

0 commit comments

Comments
 (0)