+ // Experimental round-robin
+ // Overwrites the score calculated above, but I keep it there to
+ // get the log entries
+ if (type == Metadata_sortkey_relevance_h) {
+ struct record *record;
+ int thisclient = 0;
+ struct record *bestrecord = 0;
+ int nclust = 0;
+ for (record = rec->records; record; record = record->next) {
+ if ( bestrecord == 0 || bestrecord->position < record->position )
+ bestrecord = record;
+ nclust++;
+ }
+ while ( clients[thisclient] != 0
+ && clients[thisclient] != bestrecord->client )
+ thisclient++;
+ if ( clients[thisclient] == 0 )
+ {
+ yaz_log(YLOG_LOG,"round-robin: found new client at %d: p=%p\n", thisclient, bestrecord->client);
+ clients[thisclient] = bestrecord->client;
+ }
+ int tfrel = relevance;
+ relevance = -(bestrecord->position * n_clients + thisclient) ;
+ wrbuf_printf(w,"round-robin score: pos=%d client=%d ncl=%d tfscore=%d score=%d\n",
+ bestrecord->position, thisclient, nclust, tfrel, relevance );
+ yaz_log(YLOG_LOG,"round-robin score: pos=%d client=%d ncl=%d score=%d",
+ bestrecord->position, thisclient, nclust, relevance );
+ }