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 *~
13 killall pazpar2 dbc-opensearch-gw
17 URL="http://localhost:9017/"
20 PZ="../../src/pazpar2"
23 echo "$PZ2 not executable. Panic"
30 ../../../dbc-opensearch-gw/dbc-opensearch-gw.pl -1 \
31 -c dbc-opensearch-gw.cfg \
32 -l dbc-opensearch-gw.log \
36 $PZ -f $CFG -l pz2.log -p $PIDFILE &
37 sleep 0.2 # make sure it has time to start
39 curl -s "$URL?command=init" > init.out
40 SESSION=`xml_grep --text_only "//session" init.out `
42 echo "Got session $SESSION"
43 SES="&session=$SESSION"
52 QRY=`echo $Q | sed 's/ /+/g' `
54 SORT="sort=relevance_h"
55 #SEARCH="command=search$SES&$QRY&rank=1&sort=relevance"
56 #SEARCH="command=search$SES&$QRY"
57 #SEARCH="command=search$SES&query=$QRY&sort=relevance"
58 SEARCH="command=search$SES&query=$QRY&$SORT"
60 curl -s "$URL?$SEARCH" > search.out
61 cat search.out | grep search
63 sleep 0.5 # let the search start working
65 STAT="command=stat&$SES"
68 while [ $LOOPING = 1 ]
71 curl -s "$URL?$STAT" > stat.out
72 ACT=`xml_grep --text_only "//activeclients" stat.out`
73 HIT=`xml_grep --text_only "//hits" stat.out`
74 REC=`xml_grep --text_only "//records" stat.out`
76 if grep -q "<activeclients>0</activeclients>" stat.out
81 cat stat.out >> stats.out
85 SHOW="command=show$SES&start=0&num=100&$SORT"
87 curl -s "http://localhost:9017/?$SHOW" > show.out
88 #grep "relevance" show.out | grep += | grep -v "(0)"
89 #grep "round-robin" show.out
90 grep '^ <md-title>' show.out | head -11
91 grep 'Received' dbc-opensearch-gw.log | head -1 >> titles.out
92 grep '^ <md-title>' show.out >> titles.out
95 DF=`echo $QRY | sed 's/@//g' | sed 's/[+"]/_/g' | sed s"/'//g "`
96 grep "round-robin" show.out |
99 awk '{print FNR,$0}'> $DF.data
101 grep mergeplot show.out > merge.tmp
104 echo "0 0 0" > merge.data
105 for lno in `cat merge.tmp | cut -d ' ' -f2`
107 if [ "$lno" != "$LAST" ]
109 echo "Found line $lno at $LINENUMBER"
110 grep "mergeplot $lno " merge.tmp | sed "s/mergeplot/$LINENUMBER/" >> merge.data
112 LINENUMBER=$(($LINENUMBER + 1))
115 echo "$LINENUMBER 0 0 0" >> merge.data
122 #set yrange [0:300000]
127 BF=`basename $F .data | sed 's/_/ /g' `
128 echo -n " \"$F\" using 1:2 with points title \"$BF\", " >> plot.cmd
130 echo "0 notitle" >> plot.cmd
137 set out \"cluster.png\"
140 plot \"merge.data\" using 1:3 with points title \"records\", \
141 \"merge.data\" using 1:6 with points title \"avg score\"
143 cat plot.cmd | gnuplot
145 #\"merge.data\" using 1:4 with points title \"merged score\", \
146 #\"merge.data\" using 1:5 with points title \"sum score\", \