/* This file is part of Pazpar2.
- Copyright (C) 2006-2013 Index Data
+ Copyright (C) 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
// This is the old behavior, and the default
const int scorefield_internal = -2; // use our tf/idf, but normalize it
const int scorefield_position = -3; // fake a score based on the position
+// Positive numbers indicate the field to be used for scoring.
// A structure for each (sub)record. There is one list for each client
struct norm_record
}
-// Add a record in the list for that client, for normalizing later
+// Add all records from a cluster into the list for that client, for normalizing later
static void setup_norm_record( struct relevance *rel, struct record_cluster *clust)
{
struct record *record;
}
yaz_log(YLOG_LOG,"Got score for %d/%d : %f ",
norm->num, record->position, rp->score );
+ record -> score = rp->score;
if ( norm->count == 1 )
{
norm->max = rp->score;
double r = nr->score;
r = norm->a * r + norm -> b;
nr->clust->relevance_score = 10000 * r;
+ nr->record->score = r;
yaz_log(YLOG_LOG,"Normalized %f * %f + %f = %f",
nr->score, norm->a, norm->b, r );
// TODO - This keeps overwriting the cluster score in random order!
- // Need to merge results better
+ // Need to merge results better
}
-
}
-
} // client loop
}
rel->doc_frequency_vec[i]);
}
}
- // Calculate relevance for each document
+ // Calculate relevance for each document (cluster)
while (1)
{
int relevance = 0;
// Build the normalizing structures
// List of (sub)records for each target
setup_norm_record( rel, rec );
-
- // TODO - Loop again, merge individual record scores into clusters
- // Can I reset the reclist, or can I leave and enter without race conditions?
-
+
} // cluster loop
normalize_scores(rel);
-
+
+ // TODO - Calculate the cluster scores from individual records
+ // At the moment the record scoring puts one of them in the cluster...
+ reclist_rewind(reclist);
+
reclist_leave(reclist);
xfree(idfvec);