3 # Simple script (and config) to get pz2 to run against DBC's OpenSearch, and
4 # calculate rankings. See how they differ for different queries
10 rm -f $PIDFILE $YAZPIDFILE *.out *.log *.data *~ plot.cmd
17 URL="http://localhost:9017/"
20 PZ="../../src/pazpar2"
23 echo "$PZ2 not executable. Panic"
29 $PZ -f $CFG -l pz2.log -p $PIDFILE &
30 sleep 0.2 # make sure it has time to start
32 curl -s "$URL?command=init" > init.out
33 SESSION=`xml_grep --text_only "//session" init.out `
35 echo "Got session $SESSION"
36 SES="&session=$SESSION"
53 QRY=`echo $Q | sed 's/ /+/g' `
56 SORT="sort=relevance_h"
57 #SEARCH="command=search$SES&$QRY&rank=1&sort=relevance"
58 #SEARCH="command=search$SES&$QRY"
59 #SEARCH="command=search$SES&query=$QRY&sort=relevance"
60 SEARCH="command=search$SES&query=$QRY&$SORT"
62 curl -s "$URL?$SEARCH" > search.out
63 cat search.out | grep search
65 sleep 0.5 # let the search start working
67 STAT="command=stat&$SES"
70 while [ $LOOPING = 1 ]
73 curl -s "$URL?$STAT" > stat.out
74 ACT=`xml_grep --text_only "//activeclients" stat.out`
75 HIT=`xml_grep --text_only "//hits" stat.out`
76 REC=`xml_grep --text_only "//records" stat.out`
78 if grep -q "<activeclients>0</activeclients>" stat.out
83 cat stat.out >> stats.out
87 SHOW="command=show$SES&start=0&num=100&$SORT"
89 curl -s "http://localhost:9017/?$SHOW" > show.out
90 #grep "relevance" show.out | grep += | grep -v "(0)"
91 #grep "round-robin" show.out
93 # Plot the lines created by the code
94 grep plotline show.out > scores.data
96 cat scores.data | cut -d' ' -f2 | sort -u
102 set title \"$HEADLINE\"
105 plot "scores.data" using 0:($2==0?$6:1/0) with points title "db-1", \
106 "scores.data" using 0:($2==1?$6:1/0) with points title "db-2", \
107 "scores.data" using 0:($2==2?$6:1/0) with points title "db-3", \
108 "scores.data" using 0:($2==3?$6:1/0) with points title "db-4", \
109 "scores.data" using 0:($2==4?$6:1/0) with points title "db-5", \
110 "scores.data" using 0:($2==5?$6:1/0) with points title "db-6" \
112 cat plot.cmd | gnuplot
115 exit 1 # The old plotting code
118 DF=`echo $QRY | sed 's/@//g' | sed 's/[+"]/_/g' | sed s"/'//g "`
119 grep "round-robin" show.out |
122 awk '{print FNR,$0}'> $DF.data
129 #set yrange [0:300000]
134 BF=`basename $F .data | sed 's/_/ /g' `
135 echo -n " \"$F\" using 1:2 with points title \"$BF\", " >> plot.cmd
137 echo "0 notitle" >> plot.cmd