From a710d4fea18aa8e473d0a54c37afa4c396491034 Mon Sep 17 00:00:00 2001 From: Heikki Levanto Date: Mon, 25 Nov 2013 13:07:52 +0100 Subject: [PATCH] More debug output --- heikki/README-HEIKKI | 9 +++++++++ heikki/test1.sh | 16 +++++++++++++++- src/relevance.c | 6 +++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/heikki/README-HEIKKI b/heikki/README-HEIKKI index a6ca02d..4e1eebf 100644 --- a/heikki/README-HEIKKI +++ b/heikki/README-HEIKKI @@ -38,3 +38,12 @@ Next: See if I can implement a round robin. - 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. diff --git a/heikki/test1.sh b/heikki/test1.sh index a742ce0..5aedbaa 100755 --- a/heikki/test1.sh +++ b/heikki/test1.sh @@ -63,11 +63,25 @@ do 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" diff --git a/src/relevance.c b/src/relevance.c index a17c4a1..2e5411b 100644 --- a/src/relevance.c +++ b/src/relevance.c @@ -442,10 +442,10 @@ void relevance_prepare_read(struct relevance *rel, struct reclist *reclist, 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 ); } -- 1.7.10.4