New tests for the forward function (simple ands and ors)
authorHeikki Levanto <heikki@indexdata.dk>
Fri, 30 Jan 2004 13:06:37 +0000 (13:06 +0000)
committerHeikki Levanto <heikki@indexdata.dk>
Fri, 30 Jan 2004 13:06:37 +0000 (13:06 +0000)
test/gils/test3.sh [new file with mode: 0755]

diff --git a/test/gils/test3.sh b/test/gils/test3.sh
new file mode 100755 (executable)
index 0000000..9f74a5e
--- /dev/null
@@ -0,0 +1,139 @@
+#!/bin/sh
+# $Id: test3.sh,v 1.1 2004-01-30 13:06:37 heikki Exp $
+
+# Testing searches with lots of @and operators
+# in order to test the fast-forward operation of rsets
+
+LOG=test3.log
+# DBG="-v 1647"
+
+rm -f $LOG
+echo "killing old server (if any)..." >>$LOG
+test -f zebrasrv.pid && kill `cat zebrasrv.pid`
+rm -f zebrasrv.pid
+
+echo  "initializing..." >>$LOG
+mkdir -p reg
+../../index/zebraidx -l $LOG -c zebra1.cfg init || exit 1
+
+echo "updating..." >>$LOG
+../../index/zebraidx -l $LOG -c zebra1.cfg update records  || exit 1
+
+echo "starting server..." >>$LOG
+../../index/zebrasrv -S -c zebra1.cfg $DBG -l $LOG tcp:@:9901 &
+sleep 1
+
+echo "checking it runs..." >>$LOG
+test -f zebrasrv.pid || exit 1
+
+echo "search A1..." >>$LOG
+../api/testclient localhost:9901 utah > log || exit 1
+grep "^Result count: 17$" log >/dev/null || exit 1
+
+echo "search A2..." >>$LOG
+../api/testclient localhost:9901 the > log || exit 1
+grep "^Result count: 30$" log >/dev/null || exit 1
+
+echo "search A3..." >>$LOG
+../api/testclient localhost:9901 deposits > log || exit 1
+grep "^Result count: 4$" log >/dev/null || exit 1
+
+
+echo "search B1..." >>$LOG
+../api/testclient localhost:9901 "@and utah the" > log || exit 1
+grep "^Result count: 7$" log >/dev/null || exit 1
+
+echo "search B2..." >>$LOG
+../api/testclient localhost:9901 "@and the utah" > log || exit 1
+grep "^Result count: 7$" log >/dev/null || exit 1
+
+echo "search C1..." >>$LOG
+../api/testclient localhost:9901 "@and @and the utah epicenter" > log || exit 1
+grep "^Result count: 1$" log >/dev/null || exit 1
+
+echo "search C2..." >>$LOG
+../api/testclient localhost:9901 "@and @and the epicenter utah" > log || exit 1
+grep "^Result count: 1$" log >/dev/null || exit 1
+
+echo "search C3..." >>$LOG
+../api/testclient localhost:9901 "@and @and utah the epicenter" > log || exit 1
+grep "^Result count: 1$" log >/dev/null || exit 1
+
+echo "search C4..." >>$LOG
+../api/testclient localhost:9901 "@and @and utah epicenter the" > log || exit 1
+grep "^Result count: 1$" log >/dev/null || exit 1
+
+echo "search C5..." >>$LOG
+../api/testclient localhost:9901 "@and @and epicenter the utah" > log || exit 1
+grep "^Result count: 1$" log >/dev/null || exit 1
+
+echo "search C6..." >>$LOG
+../api/testclient localhost:9901 "@and @and epicenter utah the" > log || exit 1
+grep "^Result count: 1$" log >/dev/null || exit 1
+
+
+echo "search D1..." >>$LOG
+../api/testclient localhost:9901 "@and the of "  > log || exit 1
+grep "^Result count: 29$" log >/dev/null || exit 1
+
+echo "search D2..." >>$LOG
+../api/testclient localhost:9901 "@and of the"  > log || exit 1
+grep "^Result count: 29$" log >/dev/null || exit 1
+
+echo "search D3..." >>$LOG
+../api/testclient localhost:9901 "@and @and the of of"  > log || exit 1
+grep "^Result count: 29$" log >/dev/null || exit 1
+
+echo "search D4..." >>$LOG
+../api/testclient localhost:9901 "@and @and of the the"  > log || exit 1
+grep "^Result count: 29$" log >/dev/null || exit 1
+
+echo "search D5..." >>$LOG
+../api/testclient localhost:9901 "@and @and @and the of of the"  > log || exit 1
+grep "^Result count: 29$" log >/dev/null || exit 1
+
+echo "search E1..." >>$LOG
+../api/testclient localhost:9901 "@or the utah"  > log || exit 1
+grep "^Result count: 40$" log >/dev/null || exit 1
+
+echo "search E2..." >>$LOG
+../api/testclient localhost:9901 "@or utah the"  > log || exit 1
+grep "^Result count: 40$" log >/dev/null || exit 1
+
+echo "search E3..." >>$LOG
+../api/testclient localhost:9901 "@or deposits @or the utah"  > log || exit 1
+grep "^Result count: 42$" log >/dev/null || exit 1
+
+echo "search E4..." >>$LOG
+../api/testclient localhost:9901 "@and deposits @or the utah"  > log || exit 1
+grep "^Result count: 2$" log >/dev/null || exit 1
+
+echo "search E5..." >>$LOG
+../api/testclient localhost:9901 "@and @or the utah deposits"  > log || exit 1
+grep "^Result count: 2$" log >/dev/null || exit 1
+
+echo "search F1..." >>$LOG
+../api/testclient localhost:9901 "@not the utah "  > log || exit 1
+grep "^Result count: 23$" log >/dev/null || exit 1
+
+echo "search F2..." >>$LOG
+../api/testclient localhost:9901 "@not utah the "  > log || exit 1
+grep "^Result count: 10$" log >/dev/null || exit 1
+
+echo "search F3..." >>$LOG
+../api/testclient localhost:9901 "@and deposits @not utah the "  > log || exit 1
+grep "^Result count: 1$" log >/dev/null || exit 1
+
+echo "search F4..." >>$LOG
+../api/testclient localhost:9901 "@and @not utah the deposits"  > log || exit 1
+grep "^Result count: 1$" log >/dev/null || exit 1
+
+
+echo "stopping server..." >>$LOG
+test -f zebrasrv.pid || exit 1
+kill `cat zebrasrv.pid` || exit 1
+rm -f zebrasrv.pid
+sleep 1
+
+echo "Test successfully completed" >>$LOG
+