3 # Simple script (and config) to get pz2 to run against yaz-ztest, and
4 # calculate rankings. See how they differ for different queries
6 # (uses curl and xml-twig-tools)
11 rm -f $PIDFILE $YAZPIDFILE *.out *.log *~
15 URL="http://localhost:9017/"
21 YAZPIDFILE=yaz-ztest.pid
23 yaz-ztest -p $YAZPIDFILE -l yaz-ztest.log &
27 $PZ -f $CFG -l pz2.log -p $PIDFILE &
28 sleep 0.2 # make sure it has time to start
30 curl -s "$URL?command=init" > init.out
31 SESSION=`xml_grep --text_only "//session" init.out `
33 echo "Got session $SESSION"
34 SES="&session=$SESSION"
38 #SEARCH="command=search$SES&$QRY&rank=1&sort=relevance"
39 #SEARCH="command=search$SES&$QRY"
40 SEARCH="command=search$SES&$QRY&sort=relevance"
42 curl -s "$URL?$SEARCH" > search.out
43 cat search.out | grep search
46 STAT="command=stat&$SES"
49 while [ $LOOPING = 1 ]
52 curl -s "$URL?$STAT" > stat.out
53 ACT=`xml_grep --text_only "//activeclients" stat.out`
54 HIT=`xml_grep --text_only "//hits" stat.out`
55 REC=`xml_grep --text_only "//records" stat.out`
57 if grep -q "<activeclients>0</activeclients>" stat.out
62 cat stat.out >> stats.out
66 SHOW="command=show$SES&sort=relevance_h&start=0&num=100"
68 curl -s "http://localhost:9017/?$SHOW" > show.out
69 #grep "relevance" show.out | grep += | grep -v "(0)"
70 grep "round-robin" show.out
73 grep "round-robin" show.out |
76 awk '{print FNR,$0}'> plot.data
81 plot "plot.data" using 1:2 with points title "tf/idf", \
82 "plot.data" using 1:($3*300) with points title "round-robin"
89 kill `cat $YAZPIDFILE`
90 rm -f $PIDFILE $YAZPIDFILE