-/* $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
*/
/* 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,
-/* $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
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);
-/* $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
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;
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)
{
-/* $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
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)
.deps
Makefile
Makefile.in
-t1
-t2
+t[0-9]
*.mf
*.LCK
+t[0-9].log
+# $Id: Makefile.am,v 1.9 2003-05-20 13:52:41 adam Exp $
+TESTS = t1 t2 t3
EXTRA_PROGRAMS = t1 t2 t3
-/* $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
02111-1307, USA.
*/
-
-
+#include <yaz/log.h>
#include <zebraapi.h>
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);
-/* $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
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 ();
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);
nmem_exit ();
xmalloc_trav ("x");
- exit (0);
+ exit (exit_code);
}
-/* $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
02111-1307, USA.
*/
-
+#include <yaz/log.h>
#include <yaz/pquery.h>
#include <zebraapi.h>
"<gils>\n"
" <title>My title</title>\n"
"</gils>\n";
+
+ yaz_log_init_file("t3.log");
+
nmem_init ();
zs = zebra_start("t2.cfg");
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);
+# $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
-
+# $Id: Makefile.am,v 1.2 2003-05-20 13:52:41 adam Exp $
dist-hook:
-mkdir $(distdir)/records
+# $Id: Makefile.am,v 1.3 2003-05-20 13:52:41 adam Exp $
+
TESTS = test1.sh test2.sh test3.sh \
simple1.sh