- keep an array of structs with the pointer, and locate the client number that way
- robin-score = pos * n_clients + client_num
+relevance_new_rec is called every time a new record pops up. One or more to count_word,
+exactly one to done_rec. That's where I can compare to the ranking of the previous
+record. struct_relevance is one structure I have for myself, global (for the user
+session), so I can keep my stuff in there, possibly an array of things for each target.
+
+I should also add stuff directly to the client, and to the record, as I need.
+
+Next: Plot the tf/idf scores against round-robin sorted order. Will be messy,
+but later when we get a target that returns sorted records, it will make sense.
done
-SHOW="command=show$SES&sort=relevance_h&start=0&num=1000"
+SHOW="command=show$SES&sort=relevance_h&start=0&num=100"
echo $SHOW
curl -s "http://localhost:9017/?$SHOW" > show.out
#grep "relevance" show.out | grep += | grep -v "(0)"
grep "round-robin" show.out
+
+# Plot it
+grep "round-robin" show.out |
+ cut -d' ' -f 6,7 |
+ sed 's/[^0-9 ]//g' |
+ awk '{print FNR,$0}'> plot.data
+
+echo '\
+ set term png
+ set out "plot.png"
+ plot "plot.data" using 1:2 with points title "tf/idf", \
+ "plot.data" using 1:($3*300) with points title "round-robin"
+ ' | gnuplot
+
echo
echo "All done"
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 score=%d\n",
- bestrecord->position, thisclient, nclust, relevance );
+ 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 );
}