beginnings of a small script
[pazpar2-moved-to-github.git] / heikki / test1.sh
1 #!/bin/bash
2 #
3 # Simple script (and config) to get pz2 to run against yaz-ztest, and 
4 # calculate rankings. See how they differ for different queries
5 #
6 # (uses curl and xml-twig-tools)
7
8 DIR=`cd ..; pwd`
9 HDIR=$DIR/heikki
10 CFG="$DIR/etc/heikki-test1.cfg"
11
12 PZ="$DIR/src/pazpar2"
13
14 PIDFILE=$HDIR/pz2.pid
15 YAZPIDFILE=$HDIR/yaz-ztest.pid
16
17 yaz-ztest -p $YAZPIDFILE -l yaz-ztest.log &
18
19
20 $PZ -f $CFG  -w "$DIR/etc" -l $HDIR/pz2.log -p $PIDFILE &
21 sleep 0.2 # make sure it has time to start
22 echo "Init"
23 curl -s "http://localhost:9017/?command=init" > init.out
24 SESSION=`xml_grep --text_only "//session" init.out `
25 cat init.out
26 echo "Got session $SESSION"
27 SES="&session=$SESSION"
28
29
30 QRY="query=computer"
31 #SEARCH="command=search$SES&$QRY&rank=1&sort=relevance"
32 #SEARCH="command=search$SES&$QRY"
33 SEARCH="command=search$SES&$QRY&sort=relevance"
34 echo $SEARCH
35 curl -s "http://localhost:9017/?$SEARCH" > search.out
36 cat search.out
37 echo
38
39 SHOW="command=show$SES&sort=relevance"
40 echo $SHOW
41 curl -s "http://localhost:9017/?$SHOW" > show.out
42 echo "md-score:"
43 grep "md-score" show.out
44 echo "relevance:"
45 grep "relevance" show.out
46 echo
47
48 echo "All done"
49 kill `cat $PIDFILE`
50 kill `cat $YAZPIDFILE`