Author: srowen
Date: Thu Apr  8 18:05:34 2010
New Revision: 932039

URL: http://svn.apache.org/viewvc?rev=932039&view=rev
Log:
Fix item ID column, and avoid running off end of prefs array

Modified:
    
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/jdbc/AbstractJDBCDiffStorage.java

Modified: 
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/jdbc/AbstractJDBCDiffStorage.java
URL: 
http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/jdbc/AbstractJDBCDiffStorage.java?rev=932039&r1=932038&r2=932039&view=diff
==============================================================================
--- 
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/jdbc/AbstractJDBCDiffStorage.java
 (original)
+++ 
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/jdbc/AbstractJDBCDiffStorage.java
 Thu Apr  8 18:05:34 2010
@@ -173,11 +173,14 @@ public abstract class AbstractJDBCDiffSt
       // with nulls for Preferences that have no corresponding result row
       int i = 0;
       while (rs.next()) {
-        long nextResultItemID = rs.getLong(3);
-        while (prefs.getItemID(i) != nextResultItemID) {
+        long nextResultItemID = rs.getLong(4);
+        while (i < size && prefs.getItemID(i) != nextResultItemID) {
           i++;
           // result[i] is null for these values of i
         }
+        if (i == size) {
+          break;
+        }
         result[i] = new FixedRunningAverageAndStdDev(rs.getDouble(2), 
rs.getDouble(3), rs.getInt(1));
         i++;
       }


Reply via email to