You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by gs...@apache.org on 2011/09/09 22:06:49 UTC

svn commit: r1167345 - /mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/AggregateAndRecommendReducer.java

Author: gsingers
Date: Fri Sep  9 20:06:49 2011
New Revision: 1167345

URL: http://svn.apache.org/viewvc?rev=1167345&view=rev
Log:
MAHOUT-802: make item id look ups optional

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/AggregateAndRecommendReducer.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/AggregateAndRecommendReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/AggregateAndRecommendReducer.java?rev=1167345&r1=1167344&r2=1167345&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/AggregateAndRecommendReducer.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/AggregateAndRecommendReducer.java Fri Sep  9 20:06:49 2011
@@ -189,7 +189,12 @@ public final class AggregateAndRecommend
     while (recommendationVectorIterator.hasNext()) {
       Vector.Element element = recommendationVectorIterator.next();
       int index = element.index();
-      long itemID = indexItemIDMap.get(index);
+      long itemID;
+      if (indexItemIDMap != null && indexItemIDMap.isEmpty() == false) {
+        itemID = indexItemIDMap.get(index);
+      } else { //we don't have any mappings, so just use the original
+        itemID = index;
+      }
       if (itemsToRecommendFor == null || itemsToRecommendFor.contains(itemID)) {
         float value = (float) element.get();
         if (!Float.isNaN(value)) {