Fixed bug in sort for unset entries at end of sort file.
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 10 Dec 2002 12:54:24 +0000 (12:54 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 10 Dec 2002 12:54:24 +0000 (12:54 +0000)
12 files changed:
configure.in
debian/changelog
index/sortidx.c
test/Makefile.am
test/sort/Makefile.am [new file with mode: 0644]
test/sort/my.abs [new file with mode: 0644]
test/sort/rec1.xml [new file with mode: 0644]
test/sort/rec2.xml [new file with mode: 0644]
test/sort/rec3.xml [new file with mode: 0644]
test/sort/test1.sh [new file with mode: 0755]
test/sort/zebra.cfg [new file with mode: 0644]
test/testclient.c

index 6a49836..0b13369 100644 (file)
@@ -1,5 +1,5 @@
 dnl Zebra, Index Data Aps, 1995-2002
-dnl $Id: configure.in,v 1.59 2002-11-26 21:45:28 adam Exp $
+dnl $Id: configure.in,v 1.60 2002-12-10 12:54:24 adam Exp $
 dnl
 AC_INIT(include/zebraver.h)
 AM_INIT_AUTOMAKE(idzebra,1.3.4)
@@ -334,7 +334,7 @@ AC_OUTPUT([
   doc/tkl.xsl
   test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
   perl/Makefile.PL
-  test/dmoz/Makefile test/xpath/Makefile
+  test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile
   examples/Makefile examples/gils/Makefile
 ])
 
index 2b28a05..5363ac4 100644 (file)
@@ -1,3 +1,9 @@
+idzebra (1.3.4-2) unstable; urgency=low
+
+  * Fixed bug in sort for unset entries at end of sort file.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Tue, 10 Dec 2002 13:53:10 +0100
+
 idzebra (1.3.4-1) unstable; urgency=low
 
   * Upstream.
index 9524b97..fe55828 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: sortidx.c,v 1.7 2002-08-02 19:26:55 adam Exp $
+/* $Id: sortidx.c,v 1.8 2002-12-10 12:54:24 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -138,5 +138,7 @@ void sortIdx_add (SortIdx si, const char *buf, int len)
 
 void sortIdx_read (SortIdx si, char *buf)
 {
-    bf_read (si->current_file->bf, si->sysno+1, 0, 0, buf);
+    int r = bf_read (si->current_file->bf, si->sysno+1, 0, 0, buf);
+    if (!r)
+        memset (buf, 0, SORT_IDX_ENTRYSIZE);
 }
index 8ef10be..1b7443b 100644 (file)
@@ -1,5 +1,5 @@
 
-SUBDIRS=gils usmarc api dmoz xpath
+SUBDIRS=gils usmarc api dmoz xpath sort
 
 testclient_SOURCES = testclient.c
 
diff --git a/test/sort/Makefile.am b/test/sort/Makefile.am
new file mode 100644 (file)
index 0000000..b00e9b4
--- /dev/null
@@ -0,0 +1,4 @@
+TESTS = test1.sh
+
+EXTRA_DIST = $(TESTS) zebra.cfg rec1.xml rec2.xml rec3.xml zebra.cfg my.abs
+
diff --git a/test/sort/my.abs b/test/sort/my.abs
new file mode 100644 (file)
index 0000000..1ade037
--- /dev/null
@@ -0,0 +1,14 @@
+# $Id: my.abs,v 1.1 2002-12-10 12:54:24 adam Exp $
+
+name my
+reference WAIS-schema
+attset bib1.att
+tagset generic.tag
+
+varset var1.var
+
+esetname B @
+esetname F @
+
+elm (2,1)              Title                   !:p,!:w
+elm (2,8)              Date                    !:s
diff --git a/test/sort/rec1.xml b/test/sort/rec1.xml
new file mode 100644 (file)
index 0000000..781d74a
--- /dev/null
@@ -0,0 +1,4 @@
+<my>
+  <title>first computer</title>
+  <dateTime>2</dateTime>
+</my>
diff --git a/test/sort/rec2.xml b/test/sort/rec2.xml
new file mode 100644 (file)
index 0000000..fa58c19
--- /dev/null
@@ -0,0 +1,4 @@
+<my>
+  <title>second computer</title>
+  <dateTime>1</dateTime>
+</my>
diff --git a/test/sort/rec3.xml b/test/sort/rec3.xml
new file mode 100644 (file)
index 0000000..2b44c52
--- /dev/null
@@ -0,0 +1,3 @@
+<my>
+  <title>third computer</title>
+</my>
diff --git a/test/sort/test1.sh b/test/sort/test1.sh
new file mode 100755 (executable)
index 0000000..62b428a
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+LOG=test1.log
+rm -fr lock
+mkdir lock
+rm -fr reg
+mkdir reg
+rm -fr recs
+mkdir recs
+cp rec*.xml recs
+../../index/zebraidx -l $LOG update recs || exit 1
+../../index/zebrasrv -l $LOG unix:socket &
+sleep 1
+test -f zebrasrv.pid || exit 2
+../testclient -n3 unix:socket '@or computer @attr 7=1 @attr 1=30 0' >tmp1
+echo 'Result count: 3
+my:
+  title: third computer
+my:
+  title: second computer
+  dateTime: 1
+my:
+  title: first computer
+  dateTime: 2' >tmp2
+
+kill `cat zebrasrv.pid`
+diff tmp1 tmp2
diff --git a/test/sort/zebra.cfg b/test/sort/zebra.cfg
new file mode 100644 (file)
index 0000000..f91a9ad
--- /dev/null
@@ -0,0 +1,15 @@
+# Simple Zebra configuration file
+# $Id: zebra.cfg,v 1.1 2002-12-10 12:54:24 adam Exp $
+#
+# Where the schema files, attribute files, etc are located.
+profilePath: .:../../tab
+
+# Files that describe the attribute sets supported.
+attset: bib1.att
+attset: explain.att
+
+recordtype.xml: grs.sgml
+recordId: file
+lockdir: lock
+register: reg:20M
+isam: b
index eec7ff1..e40b97a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: testclient.c,v 1.7 2002-11-11 15:41:19 heikki Exp $
+ * $Id: testclient.c,v 1.8 2002-12-10 12:54:24 adam Exp $
  *
  * Z39.50 client specifically for Zebra testing.
  */
@@ -59,7 +59,7 @@ int main(int argc, char **argv)
         default:
             printf ("%s: unknown option %s\n", prog, arg);
             printf ("usage:\n%s [options] target query \n", prog);
-            printf (" eg.  bagel.indexdata.dk/gils computer\n");
+            printf (" eg.  indexdata.dk/gils computer\n");
             exit (1);
         }
     }
@@ -74,7 +74,6 @@ int main(int argc, char **argv)
         printf (" -o off       offset for records - counting from 0.\n");
         printf (" -f format    set record syntax. Default: none\n");
         printf (" -d sec       delay a number of seconds before exit.\n");
-        printf ("Options\n");
         exit (3);
     }
     z = ZOOM_connection_new (target, 0);