+Bug fix: result sets were not recovered correctly. Had to
+add ODR handle for zebra_search_RPN in order to make it work.
+
+Fixed a bug in regx filters that didn't do anchors (^) correctly.
+
Fixed a bug in searches with X-Path searches sometimes giving "extra"
hits.
-/* $Id: dfa.c,v 1.28 2002-08-02 19:26:55 adam Exp $
+/* $Id: dfa.c,v 1.29 2003-06-18 11:46:33 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
init_DFA_states (&dfas, parse_info->poset, (int) (STATE_HASH));
mk_dfa_tran (parse_info, dfas);
if (debug_dfa_tran)
+ {
+ printf ("PR_TRAN\n");
pr_tran (parse_info, dfas);
+ }
if (dfa_verbose)
pr_verbose (parse_info, dfas);
del_pos(parse_info);
-/* $Id: zebraapi.h,v 1.6 2003-05-20 13:54:30 adam Exp $
+/* $Id: zebraapi.h,v 1.7 2003-06-18 11:46:33 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
const char *setname);
/* Search using RPN Query */
-YAZ_EXPORT void zebra_search_RPN (ZebraHandle zh, Z_RPNQuery *query,
+YAZ_EXPORT void zebra_search_RPN (ZebraHandle zh, ODR o, Z_RPNQuery *query,
const char *setname, int *hits);
/* Retrieve record(s) */
-/* $Id: apitest.c,v 1.13 2003-05-20 13:52:41 adam Exp $
+/* $Id: apitest.c,v 1.14 2003-06-18 11:46:33 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, query, setname, &hits);
+ zebra_search_RPN (zh, odr_input, query, setname, &hits);
/* status ... */
zebra_result (zh, &errCode, &errString);
-/* $Id: index.h,v 1.99 2003-05-20 12:52:49 adam Exp $
+/* $Id: index.h,v 1.100 2003-06-18 11:46:33 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
int use, const char *term);
ZebraSet resultSetAdd (ZebraHandle zh, const char *name, int ov);
ZebraSet resultSetGet (ZebraHandle zh, const char *name);
-ZebraSet resultSetAddRPN (ZebraHandle zh, Z_RPNQuery *rpn,
+ZebraSet resultSetAddRPN (ZebraHandle zh, NMEM m, Z_RPNQuery *rpn,
int num_bases, char **basenames,
const char *setname);
RSET resultSetRef (ZebraHandle zh, const char *resultSetId);
-/* $Id: zebraapi.c,v 1.104 2003-06-17 13:53:27 adam Exp $
+/* $Id: zebraapi.c,v 1.105 2003-06-18 11:46:33 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
assert (res);
yaz_log (LOG_LOG|LOG_API, "zebra_register_open rw = %d useshadow=%d p=%p,n=%s,rp=%s",
- rw, useshadow, reg, name, reg_path);
+ rw, useshadow, reg, name, reg_path ? reg_path : "(none)");
reg->dh = data1_createx (DATA1_FLAG_XML);
if (!reg->dh)
return 0;
}
-void zebra_search_RPN (ZebraHandle zh,
+void zebra_search_RPN (ZebraHandle zh, ODR o,
Z_RPNQuery *query, const char *setname, int *hits)
{
ASSERTZH;
zebra_livcode_transform(zh, query);
- resultSetAddRPN (zh, query,
+ resultSetAddRPN (zh, odr_extract_mem(o), query,
zh->num_basenames, zh->basenames, setname);
zebra_end_read (zh);
long p = getpid();
FILE *f;
ASSERTZH;
- yaz_log(LOG_API,"zebra_set_state v=%d seq=%s", val, seqno);
+ yaz_log(LOG_API,"zebra_set_state v=%d seq=%d", val, seqno);
zh->errCode=0;
sprintf (state_fname, "state.%s.LCK", zh->reg_name);
if (!query)
yaz_log (LOG_WARN, "bad query %s\n", pqf_query);
else
- zebra_search_RPN (zh, query, setname, &hits);
+ zebra_search_RPN (zh, odr, query, setname, &hits);
odr_destroy(odr);
-/* $Id: zserver.c,v 1.107 2003-05-24 22:35:11 adam Exp $
+/* $Id: zserver.c,v 1.108 2003-06-18 11:46:33 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->query->u.type_1,
+ zebra_search_RPN (zh, r->stream, r->query->u.type_1,
r->setname, &r->hits);
zebra_result (zh, &r->errcode, &r->errstring);
if (!r->errcode)
-/* $Id: zsets.c,v 1.45 2003-05-20 12:52:50 adam Exp $
+/* $Id: zsets.c,v 1.46 2003-06-18 11:46:34 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
struct zset_sort_entry **entries;
};
-ZebraSet resultSetAddRPN (ZebraHandle zh,
+ZebraSet resultSetAddRPN (ZebraHandle zh, NMEM m,
Z_RPNQuery *rpn, int num_bases,
char **basenames,
const char *setname)
return 0;
zebraSet->locked = 1;
zebraSet->rpn = 0;
- zebraSet->nmem = nmem_create ();
+ zebraSet->nmem = m;
zebraSet->num_bases = num_bases;
zebraSet->basenames =
-# $Id: Makefile.am,v 1.10 2003-05-21 14:39:22 adam Exp $
+# $Id: Makefile.am,v 1.11 2003-06-18 11:46:34 adam Exp $
-TESTS = t1 t2 t3
+TESTS = t1 t2 t3 t4
testclient_SOURCES = testclient.c
noinst_PROGRAMS = testclient
-EXTRA_PROGRAMS = t1 t2 t3
+EXTRA_PROGRAMS = t1 t2 t3 t4
EXTRA_DIST=t1.cfg t2.cfg
t1_SOURCES = t1.c
t2_SOURCES = t2.c
t3_SOURCES = t3.c
+t4_SOURCES = t4.c
AM_CPPFLAGS = -I$(top_srcdir)/include $(YAZINC)
-/* $Id: t3.c,v 1.2 2003-05-20 13:52:41 adam Exp $
+/* $Id: t3.c,v 1.3 2003-06-18 11:46:34 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
zebra_begin_trans (zh, 0);
sprintf(setname, "s%d", i+1);
- zebra_search_RPN (zh, query, setname, &hits);
+ zebra_search_RPN (zh, odr_input, query, setname, &hits);
zebra_end_trans (zh);
zebra_end_trans (zh);
--- /dev/null
+/* $Id: t4.c,v 1.1 2003-06-18 11:46:34 adam Exp $
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
+ Index Data Aps
+
+This file is part of the Zebra server.
+
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with Zebra; see the file LICENSE.zebra. If not, write to the
+Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+*/
+
+#include <yaz/log.h>
+#include <yaz/pquery.h>
+#include <zebraapi.h>
+
+int main(int argc, char **argv)
+{
+ int i;
+ ZebraService zs;
+ ZebraHandle zh;
+ const char *myrec =
+ "<gils>\n"
+ " <title>My title</title>\n"
+ "</gils>\n";
+
+ yaz_log_init_file("t3.log");
+
+ nmem_init ();
+
+ zs = zebra_start("t2.cfg");
+ zh = zebra_open (zs);
+ zebra_select_database(zh, "Default");
+
+ zebra_begin_trans (zh, 1);
+ for (i = 0; i<1200; i++)
+ zebra_record_insert (zh, myrec, strlen(myrec));
+ zebra_end_trans (zh);
+ zebra_close(zh);
+ zebra_stop(zs);
+
+ zs = zebra_start("t2.cfg");
+ zh = zebra_open (zs);
+ zebra_select_database(zh, "Default");
+
+ for (i = 0; i<4; i++)
+ {
+ ZebraRetrievalRecord retrievalRecord[1001];
+ char setname[20];
+ int j;
+ ODR odr_input = odr_createmem (ODR_DECODE);
+ ODR odr_output = odr_createmem (ODR_DECODE);
+ YAZ_PQF_Parser parser = yaz_pqf_create();
+ Z_RPNQuery *query = yaz_pqf_parse(parser, odr_input,
+ "@attr 1=4 my");
+ int hits;
+
+ sprintf(setname, "s%d", i+1);
+ zebra_search_RPN (zh, odr_input, query, setname, &hits);
+
+ printf ("hits=%d\n", hits);
+
+ yaz_pqf_destroy(parser);
+
+ odr_destroy (odr_input);
+
+ zebra_begin_trans (zh, 1);
+
+ for (j = 0; j<1001; j++)
+ retrievalRecord[j].position = j+1;
+
+ zebra_records_retrieve (zh, odr_output, setname, 0,
+ VAL_TEXT_XML, 1001, retrievalRecord);
+
+
+ odr_destroy (odr_output);
+
+ zebra_end_trans (zh);
+
+ }
+ zebra_commit (zh);
+ zebra_close (zh);
+ zebra_stop (zs);
+
+ nmem_exit ();
+ xmalloc_trav ("x");
+ exit (0);
+}