Refactor: hide reclist structure
[pazpar2-moved-to-github.git] / src / relevance.c
index 86ba9ec..a338917 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Pazpar2.
-   Copyright (C) 2006-2008 Index Data
+   Copyright (C) 2006-2009 Index Data
 
 Pazpar2 is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <config.h>
 #endif
 
-#include <ctype.h>
 #include <math.h>
 #include <stdlib.h>
 
@@ -309,10 +308,10 @@ void relevance_prepare_read(struct relevance *rel, struct reclist *reclist)
         }
     }
     // Calculate relevance for each document
-    for (i = 0; i < reclist->num_records; i++)
+    for (i = 0; i < reclist_get_num_records(reclist); i++)
     {
         int t;
-        struct record_cluster *rec = reclist->flatlist[i];
+        struct record_cluster *rec = reclist_get_cluster(reclist, i);
         float relevance;
         relevance = 0;
         for (t = 1; t < rel->vec_len; t++)
@@ -325,14 +324,16 @@ void relevance_prepare_read(struct relevance *rel, struct reclist *reclist)
         }
         rec->relevance = (int) (relevance * 100000);
     }
-    reclist->pointer = 0;
+    reclist_rewind(reclist);
     xfree(idfvec);
 }
 
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab
  */
+