Removed zebra_search_rpn. Updated a few tests
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 20 May 2003 13:52:40 +0000 (13:52 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 20 May 2003 13:52:40 +0000 (13:52 +0000)
12 files changed:
include/zebraapi.h
index/apitest.c
index/zebraapi.c
index/zserver.c
test/api/.cvsignore
test/api/Makefile.am
test/api/t1.c
test/api/t2.c
test/api/t3.c
test/gils/Makefile.am
test/xelm/Makefile.am
test/xpath/Makefile.am

index 1733617..d91e77a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebraapi.h,v 1.4 2003-05-20 12:52:49 adam Exp $
+/* $Id: zebraapi.h,v 1.5 2003-05-20 13:52:40 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
    Index Data Aps
 
@@ -128,14 +128,12 @@ YAZ_EXPORT void zebra_result (ZebraHandle zh, int *code, char **addinfo);
  */
 
 /* Search using RPN-Query */
-YAZ_EXPORT void zebra_search_rpn (ZebraHandle zh, ODR input, ODR output,
-                                  Z_RPNQuery *query,
-                                  const char *setname, int *hits);
-
-YAZ_EXPORT int zebra_search_PQF (ZebraHandle zh, 
-                                 const char *pqf_query,
+YAZ_EXPORT int zebra_search_PQF (ZebraHandle zh, const char *pqf_query,
                                  const char *setname);
 
+YAZ_EXPORT void zebra_search_RPN (ZebraHandle zh, Z_RPNQuery *query,
+                                  const char *setname, int *hits);
+
 /* Retrieve record(s) */
 YAZ_EXPORT void zebra_records_retrieve (ZebraHandle zh, ODR stream,
                       const char *setname, Z_RecordComposition *comp,
index 787a6ac..72ba83e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: apitest.c,v 1.12 2002-08-02 19:26:55 adam Exp $
+/* $Id: apitest.c,v 1.13 2003-05-20 13:52:41 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -197,7 +197,7 @@ int main (int argc, char **argv)
        sprintf (setname, "%d", argno);
 
        /* fire up the search */
-       zebra_search_rpn (zh, odr_input, odr_output, query, setname, &hits);
+       zebra_search_RPN (zh, query, setname, &hits);
        
        /* status ... */
         zebra_result (zh, &errCode, &errString);
index 45bee3e..b3c650f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebraapi.c,v 1.100 2003-05-20 12:52:50 adam Exp $
+/* $Id: zebraapi.c,v 1.101 2003-05-20 13:52:41 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
    Index Data Aps
 
@@ -744,7 +744,7 @@ int zebra_select_databases (ZebraHandle zh, int num_bases,
     return 0;
 }
 
-void zebra_search_rpn (ZebraHandle zh, ODR decode, ODR stream,
+void zebra_search_RPN (ZebraHandle zh,
                       Z_RPNQuery *query, const char *setname, int *hits)
 {
     ASSERTZH;
@@ -1894,21 +1894,6 @@ int zebra_delete_record (ZebraHandle zh,
   is not mandatory. (it's repeatable now, also in zebraapi.c)
 */
 
-void zebra_search_RPN (ZebraHandle zh, Z_RPNQuery *query,
-                       const char *setname, int *hits)
-{
-    zh->hits = 0;
-    *hits = 0;
-
-    if (zebra_begin_read (zh))
-       return;
-    resultSetAddRPN (zh, query, zh->num_basenames, zh->basenames, setname);
-
-    zebra_end_read (zh);
-
-    *hits = zh->hits;
-}
-
 int zebra_search_PQF (ZebraHandle zh, const char *pqf_query,
                      const char *setname)
 {
index c73c02c..eb89b09 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zserver.c,v 1.105 2003-05-20 12:52:50 adam Exp $
+/* $Id: zserver.c,v 1.106 2003-05-20 13:52:41 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -262,7 +262,7 @@ int bend_search (void *handle, bend_search_rr *r)
     switch (r->query->which)
     {
     case Z_Query_type_1: case Z_Query_type_101:
-       zebra_search_rpn (zh, r->decode, r->stream, r->query->u.type_1,
+       zebra_search_RPN (zh, r->query->u.type_1,
                          r->setname, &r->hits);
         zebra_result (zh, &r->errcode, &r->errstring);
         if (!r->errcode)
index 06102d9..3045a6d 100644 (file)
@@ -1,7 +1,7 @@
 .deps
 Makefile
 Makefile.in
-t1
-t2
+t[0-9]
 *.mf
 *.LCK
+t[0-9].log
index 1fa9b0a..d5f773e 100644 (file)
@@ -1,4 +1,6 @@
+# $Id: Makefile.am,v 1.9 2003-05-20 13:52:41 adam Exp $
 
+TESTS = t1 t2 t3
 
 EXTRA_PROGRAMS = t1 t2 t3
 
index 353a533..c26ff02 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t1.c,v 1.2 2002-08-02 19:26:57 adam Exp $
+/* $Id: t1.c,v 1.3 2003-05-20 13:52:41 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -20,8 +20,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.
 */
 
-
-
+#include <yaz/log.h>
 #include <zebraapi.h>
 
 int main(int argc, char **argv)
@@ -29,6 +28,7 @@ int main(int argc, char **argv)
     ZebraService zs;
     ZebraHandle zh;
 
+    yaz_log_init_file("t1.log");
     nmem_init();
     zs = zebra_start("t1.cfg");
     zh = zebra_open (zs);
index fc359fe..fb585af 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t2.c,v 1.5 2003-05-20 12:52:50 adam Exp $
+/* $Id: t2.c,v 1.6 2003-05-20 13:52:41 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -20,20 +20,21 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.
 */
 
-
-
+#include <yaz/log.h>
 #include <zebraapi.h>
 
 int main(int argc, char **argv)
 {
-    int ret, hits;
+    int exit_code = 0;
+    int hits;
     ZebraService zs;
     ZebraHandle zh;
     const char *myrec =
         "<gils>\n"
         "  <title>My title</title>\n"
         "</gils>\n";
-    ODR odr_input, odr_output;
+
+    yaz_log_init_file("t2.log");
 
     nmem_init ();
 
@@ -44,7 +45,11 @@ int main(int argc, char **argv)
     zebra_record_insert (zh, myrec, strlen(myrec));
 
     hits = zebra_search_PQF (zh, "@attr 1=4 my", "set1");
-    printf ("hits: %d\n", hits);
+    if (hits < 1)
+    {
+        yaz_log(LOG_FATAL, "At least one hit expected");
+        exit_code = 1;
+    }
 
     zebra_end_trans (zh);
     zebra_commit (zh);
@@ -53,5 +58,5 @@ int main(int argc, char **argv)
 
     nmem_exit ();
     xmalloc_trav ("x");
-    exit (0);
+    exit (exit_code);
 }
index 771b95c..240a1d7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t3.c,v 1.1 2003-05-19 21:37:38 adam Exp $
+/* $Id: t3.c,v 1.2 2003-05-20 13:52:41 adam Exp $
    Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
    Index Data Aps
 
@@ -20,7 +20,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.
 */
 
-
+#include <yaz/log.h>
 #include <yaz/pquery.h>
 #include <zebraapi.h>
 
@@ -33,6 +33,9 @@ int main(int argc, char **argv)
         "<gils>\n"
         "  <title>My title</title>\n"
         "</gils>\n";
+
+    yaz_log_init_file("t3.log");
+
     nmem_init ();
     
     zs = zebra_start("t2.cfg");
@@ -61,7 +64,7 @@ int main(int argc, char **argv)
         zebra_begin_trans (zh, 0);
         
         sprintf(setname, "s%d", i+1);
-        zebra_search_rpn (zh, odr_input, odr_output, query, setname, &hits);
+        zebra_search_RPN (zh, query, setname, &hits);
 
         zebra_end_trans (zh);
         zebra_end_trans (zh);
index 6a0ba44..c6dcd41 100644 (file)
@@ -1,3 +1,5 @@
+# $Id: Makefile.am,v 1.14 2003-05-20 13:52:41 adam Exp $
+
 dist-hook:
        -mkdir $(distdir)/records
        cp $(srcdir)/records/*.grs $(distdir)/records
index 2f561e0..2a3e6e8 100644 (file)
@@ -1,4 +1,4 @@
-
+# $Id: Makefile.am,v 1.2 2003-05-20 13:52:41 adam Exp $
 
 dist-hook:
        -mkdir $(distdir)/records
index 6a097cc..7899503 100644 (file)
@@ -1,3 +1,5 @@
+# $Id: Makefile.am,v 1.3 2003-05-20 13:52:41 adam Exp $
+
 TESTS = test1.sh test2.sh test3.sh \
         simple1.sh