More debug output
authorHeikki Levanto <heikki@indexdata.dk>
Mon, 25 Nov 2013 12:07:52 +0000 (13:07 +0100)
committerHeikki Levanto <heikki@indexdata.dk>
Mon, 25 Nov 2013 12:07:52 +0000 (13:07 +0100)
heikki/README-HEIKKI
heikki/test1.sh
src/relevance.c

index a6ca02d..4e1eebf 100644 (file)
@@ -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.
index a742ce0..5aedbaa 100755 (executable)
@@ -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"
index a17c4a1..2e5411b 100644 (file)
@@ -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 );
         }