recctrl system.
-# $Id: Makefile.am,v 1.23 2006-05-19 13:49:33 adam Exp $
+# $Id: Makefile.am,v 1.24 2006-08-15 14:28:32 adam Exp $
noinst_HEADERS = bset.h charmap.h \
direntz.h passwddb.h dfa.h zebra_xpath.h d1_absyn.h \
-rset.h dfaset.h sortidx.h zebra-lock.h attrfind.h
+rset.h dfaset.h sortidx.h zebra-lock.h attrfind.h zebramap.h
SUBDIRS = idzebra
-# $Id: Makefile.am,v 1.10 2006-06-28 13:26:14 adam Exp $
+# $Id: Makefile.am,v 1.11 2006-08-15 14:28:33 adam Exp $
zebraincludedir=$(includedir)/$(PACKAGE)$(PACKAGE_SUFFIX)/idzebra
zebrainclude_HEADERS=api.h version.h res.h recctrl.h data1.h recgrs.h \
- zebramap.h bfile.h dict.h isam-codec.h isams.h isamc.h isamb.h util.h \
+ bfile.h dict.h isam-codec.h isams.h isamc.h isamb.h util.h \
snippet.h api_swig.h flock.h
-/* $Id: recctrl.h,v 1.26 2006-08-14 10:40:14 adam Exp $
+/* $Id: recctrl.h,v 1.27 2006-08-15 14:28:33 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
#include <idzebra/res.h>
#include <idzebra/data1.h>
#include <idzebra/snippet.h>
-#include <idzebra/zebramap.h>
YAZ_BEGIN_CDECL
zint seqno;
zint record_id;
zint section_id;
- ZebraMaps zebra_maps;
struct recExtractCtrl *extractCtrl;
} RecWord;
void *clientData;
void (*tokenAdd)(RecWord *w);
void (*setStoreData)(struct recExtractCtrl *p, void *buf, size_t size);
- ZebraMaps zebra_maps;
int first_record;
int flagShowRecords;
int seqno[256];
+++ /dev/null
-/* $Id: zebramap.h,v 1.8 2006-08-14 10:40:14 adam Exp $
- Copyright (C) 1995-2006
- 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 this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-*/
-
-#ifndef ZEBRAMAP_H
-#define ZEBRAMAP_H
-
-#include <yaz/proto.h>
-#include <idzebra/res.h>
-
-YAZ_BEGIN_CDECL
-
-typedef struct zebra_maps *ZebraMaps;
-
-YAZ_EXPORT
-ZebraMaps zebra_maps_open (Res res, const char *base_path,
- const char *profile_path);
-YAZ_EXPORT
-ZEBRA_RES zebra_maps_read_file(ZebraMaps zms, const char *fname);
-
-YAZ_EXPORT
-void zebra_maps_close (ZebraMaps zm);
-
-YAZ_EXPORT
-const char **zebra_maps_input (ZebraMaps zms, unsigned reg_id,
- const char **from, int len, int first);
-
-YAZ_EXPORT
-const char **zebra_maps_search (ZebraMaps zms, unsigned reg_id,
- const char **from, int len, int *q_map_match);
-
-YAZ_EXPORT
-const char *zebra_maps_output(ZebraMaps, unsigned reg_id, const char **from);
-
-YAZ_EXPORT
-int zebra_maps_attr (ZebraMaps zms, Z_AttributesPlusTerm *zapt,
- unsigned *reg_id, char **search_type, char *rank_type,
- int *complete_flag, int *sort_flag);
-
-YAZ_EXPORT
-int zebra_maps_sort (ZebraMaps zms, Z_SortAttributes *sortAttributes,
- int *numerical);
-
-YAZ_EXPORT
-int zebra_maps_is_complete (ZebraMaps zms, unsigned reg_id);
-
-YAZ_EXPORT
-int zebra_maps_is_sort (ZebraMaps zms, unsigned reg_id);
-
-YAZ_EXPORT
-int zebra_maps_is_alwaysmatches (ZebraMaps zms, unsigned reg_id);
-
-YAZ_EXPORT
-int zebra_maps_is_positioned (ZebraMaps zms, unsigned reg_id);
-
-YAZ_EXPORT
-WRBUF zebra_replace(ZebraMaps zms, unsigned reg_id, const char *ex_list,
- const char *input_str, int input_len);
-
-YAZ_END_CDECL
-
-#endif
-/*
- * Local variables:
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
--- /dev/null
+/* $Id: zebramap.h,v 1.19 2006-08-15 14:28:32 adam Exp $
+ Copyright (C) 1995-2006
+ 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 this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
+
+#ifndef ZEBRAMAP_H
+#define ZEBRAMAP_H
+
+#include <yaz/proto.h>
+#include <idzebra/res.h>
+
+YAZ_BEGIN_CDECL
+
+typedef struct zebra_maps *ZebraMaps;
+
+YAZ_EXPORT
+ZebraMaps zebra_maps_open (Res res, const char *base_path,
+ const char *profile_path);
+YAZ_EXPORT
+ZEBRA_RES zebra_maps_read_file(ZebraMaps zms, const char *fname);
+
+YAZ_EXPORT
+void zebra_maps_close (ZebraMaps zm);
+
+YAZ_EXPORT
+const char **zebra_maps_input (ZebraMaps zms, unsigned reg_id,
+ const char **from, int len, int first);
+
+YAZ_EXPORT
+const char **zebra_maps_search (ZebraMaps zms, unsigned reg_id,
+ const char **from, int len, int *q_map_match);
+
+YAZ_EXPORT
+const char *zebra_maps_output(ZebraMaps, unsigned reg_id, const char **from);
+
+YAZ_EXPORT
+int zebra_maps_attr (ZebraMaps zms, Z_AttributesPlusTerm *zapt,
+ unsigned *reg_id, char **search_type, char *rank_type,
+ int *complete_flag, int *sort_flag);
+
+YAZ_EXPORT
+int zebra_maps_sort (ZebraMaps zms, Z_SortAttributes *sortAttributes,
+ int *numerical);
+
+YAZ_EXPORT
+int zebra_maps_is_complete (ZebraMaps zms, unsigned reg_id);
+
+YAZ_EXPORT
+int zebra_maps_is_sort (ZebraMaps zms, unsigned reg_id);
+
+YAZ_EXPORT
+int zebra_maps_is_alwaysmatches (ZebraMaps zms, unsigned reg_id);
+
+YAZ_EXPORT
+int zebra_maps_is_positioned (ZebraMaps zms, unsigned reg_id);
+
+YAZ_EXPORT
+WRBUF zebra_replace(ZebraMaps zms, unsigned reg_id, const char *ex_list,
+ const char *input_str, int input_len);
+
+YAZ_END_CDECL
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
-/* $Id: extract.c,v 1.225 2006-08-14 10:40:15 adam Exp $
+/* $Id: extract.c,v 1.226 2006-08-15 14:28:33 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
static void extract_init (struct recExtractCtrl *p, RecWord *w)
{
- w->zebra_maps = p->zebra_maps;
w->seqno = 1;
w->index_name = "any";
w->index_type = 'w';
else
ctrl->seqno[i] = 0;
}
- ctrl->zebra_maps = zh->reg->zebra_maps;
ctrl->flagShowRecords = !zh->m_flag_rw;
}
const char *str, int length)
{
struct it_key key;
-
ZebraHandle zh = p->extractCtrl->handle;
ZebraExplainInfo zei = zh->reg->zei;
int ch;
static void extract_add_sort_string(RecWord *p, const char *str, int length)
{
struct it_key key;
-
ZebraHandle zh = p->extractCtrl->handle;
ZebraExplainInfo zei = zh->reg->zei;
int ch;
static void extract_add_string (RecWord *p, const char *string, int length)
{
+ ZebraHandle zh = p->extractCtrl->handle;
assert (length > 0);
- if (zebra_maps_is_sort (p->zebra_maps, p->index_type))
+ if (zebra_maps_is_sort (zh->reg->zebra_maps, p->index_type))
extract_add_sort_string (p, string, length);
else
{
extract_add_index_string(p, zinfo_index_category_index,
string, length);
- if (zebra_maps_is_alwaysmatches(p->zebra_maps, p->index_type))
+ if (zebra_maps_is_alwaysmatches(zh->reg->zebra_maps, p->index_type))
{
RecWord word;
memcpy(&word, p, sizeof(word));
static void extract_add_incomplete_field (RecWord *p)
{
+ ZebraHandle zh = p->extractCtrl->handle;
const char *b = p->term_buf;
int remain = p->term_len;
const char **map = 0;
if (remain > 0)
- map = zebra_maps_input(p->zebra_maps, p->index_type, &b, remain, 0);
+ map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b, remain, 0);
while (map)
{
{
remain = p->term_len - (b - p->term_buf);
if (remain > 0)
- map = zebra_maps_input(p->zebra_maps, p->index_type, &b,
+ map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b,
remain, 0);
else
map = 0;
buf[i++] = *(cp++);
remain = p->term_len - (b - p->term_buf);
if (remain > 0)
- map = zebra_maps_input(p->zebra_maps, p->index_type, &b, remain, 0);
+ map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b, remain, 0);
else
map = 0;
}
static void extract_add_complete_field (RecWord *p)
{
+ ZebraHandle zh = p->extractCtrl->handle;
const char *b = p->term_buf;
char buf[IT_MAX_WORD+1];
const char **map = 0;
int i = 0, remain = p->term_len;
if (remain > 0)
- map = zebra_maps_input (p->zebra_maps, p->index_type, &b, remain, 1);
+ map = zebra_maps_input (zh->reg->zebra_maps, p->index_type, &b, remain, 1);
while (remain > 0 && i < IT_MAX_WORD)
{
if (remain > 0)
{
int first = i ? 0 : 1; /* first position */
- map = zebra_maps_input(p->zebra_maps, p->index_type, &b, remain, first);
+ map = zebra_maps_input(zh->reg->zebra_maps, p->index_type, &b, remain, first);
}
else
map = 0;
remain = p->term_len - (b - p->term_buf);
if (remain > 0)
{
- map = zebra_maps_input (p->zebra_maps, p->index_type, &b,
+ map = zebra_maps_input (zh->reg->zebra_maps, p->index_type, &b,
remain, 0);
}
else
static void extract_token_add(RecWord *p)
{
+ ZebraHandle zh = p->extractCtrl->handle;
WRBUF wrbuf;
if (log_level)
yaz_log(log_level, "extract_token_add "
"type=%c index=%s seqno=" ZINT_FORMAT " s=%.*s",
p->index_type, p->index_name,
p->seqno, p->term_len, p->term_buf);
- if ((wrbuf = zebra_replace(p->zebra_maps, p->index_type, 0,
+ if ((wrbuf = zebra_replace(zh->reg->zebra_maps, p->index_type, 0,
p->term_buf, p->term_len)))
{
p->term_buf = wrbuf_buf(wrbuf);
p->term_len = wrbuf_len(wrbuf);
}
- if (zebra_maps_is_complete (p->zebra_maps, p->index_type))
+ if (zebra_maps_is_complete (zh->reg->zebra_maps, p->index_type))
extract_add_complete_field (p);
else
extract_add_incomplete_field(p);
-/* $Id: index.h,v 1.171 2006-08-14 10:40:15 adam Exp $
+/* $Id: index.h,v 1.172 2006-08-15 14:28:34 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
#include "zinfo.h"
#include <passwddb.h>
#include <rset.h>
+#include <zebramap.h>
YAZ_BEGIN_CDECL
-/* $Id: zebramap.c,v 1.51 2006-06-23 11:21:38 adam Exp $
+/* $Id: zebramap.c,v 1.52 2006-08-15 14:28:35 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
#include <attrfind.h>
#include <yaz/yaz-util.h>
-#include <idzebra/zebramap.h>
+#include <zebramap.h>
#define ZEBRA_MAP_TYPE_SORT 1
#define ZEBRA_MAP_TYPE_INDEX 2