From 39d323b0aabcc0f1a08f37c3fa45fb187c7570ac Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 20 May 2003 13:52:40 +0000 Subject: [PATCH] Removed zebra_search_rpn. Updated a few tests --- include/zebraapi.h | 12 +++++------- index/apitest.c | 4 ++-- index/zebraapi.c | 19 ++----------------- index/zserver.c | 4 ++-- test/api/.cvsignore | 4 ++-- test/api/Makefile.am | 2 ++ test/api/t1.c | 6 +++--- test/api/t2.c | 19 ++++++++++++------- test/api/t3.c | 9 ++++++--- test/gils/Makefile.am | 2 ++ test/xelm/Makefile.am | 2 +- test/xpath/Makefile.am | 2 ++ 12 files changed, 41 insertions(+), 44 deletions(-) diff --git a/include/zebraapi.h b/include/zebraapi.h index 1733617..d91e77a 100644 --- a/include/zebraapi.h +++ b/include/zebraapi.h @@ -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, diff --git a/index/apitest.c b/index/apitest.c index 787a6ac..72ba83e 100644 --- a/index/apitest.c +++ b/index/apitest.c @@ -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); diff --git a/index/zebraapi.c b/index/zebraapi.c index 45bee3e..b3c650f 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -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) { diff --git a/index/zserver.c b/index/zserver.c index c73c02c..eb89b09 100644 --- a/index/zserver.c +++ b/index/zserver.c @@ -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) diff --git a/test/api/.cvsignore b/test/api/.cvsignore index 06102d9..3045a6d 100644 --- a/test/api/.cvsignore +++ b/test/api/.cvsignore @@ -1,7 +1,7 @@ .deps Makefile Makefile.in -t1 -t2 +t[0-9] *.mf *.LCK +t[0-9].log diff --git a/test/api/Makefile.am b/test/api/Makefile.am index 1fa9b0a..d5f773e 100644 --- a/test/api/Makefile.am +++ b/test/api/Makefile.am @@ -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 diff --git a/test/api/t1.c b/test/api/t1.c index 353a533..c26ff02 100644 --- a/test/api/t1.c +++ b/test/api/t1.c @@ -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 #include 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); diff --git a/test/api/t2.c b/test/api/t2.c index fc359fe..fb585af 100644 --- a/test/api/t2.c +++ b/test/api/t2.c @@ -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 #include int main(int argc, char **argv) { - int ret, hits; + int exit_code = 0; + int hits; ZebraService zs; ZebraHandle zh; const char *myrec = "\n" " My title\n" "\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); } diff --git a/test/api/t3.c b/test/api/t3.c index 771b95c..240a1d7 100644 --- a/test/api/t3.c +++ b/test/api/t3.c @@ -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 #include #include @@ -33,6 +33,9 @@ int main(int argc, char **argv) "\n" " My title\n" "\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); diff --git a/test/gils/Makefile.am b/test/gils/Makefile.am index 6a0ba44..c6dcd41 100644 --- a/test/gils/Makefile.am +++ b/test/gils/Makefile.am @@ -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 diff --git a/test/xelm/Makefile.am b/test/xelm/Makefile.am index 2f561e0..2a3e6e8 100644 --- a/test/xelm/Makefile.am +++ b/test/xelm/Makefile.am @@ -1,4 +1,4 @@ - +# $Id: Makefile.am,v 1.2 2003-05-20 13:52:41 adam Exp $ dist-hook: -mkdir $(distdir)/records diff --git a/test/xpath/Makefile.am b/test/xpath/Makefile.am index 6a097cc..7899503 100644 --- a/test/xpath/Makefile.am +++ b/test/xpath/Makefile.am @@ -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 -- 1.7.10.4