+New .abs directive, systag, that control where to put retrieval
+information. The directive takes two arguments: system tag, actual tag.
+System tag is one of : rank, sysno, size with the default actual
+rank, localControlNumber, size .
+
--- 1.3.4 2002/11/26
Perl Filter and Perl API. By Peter Popovics.
-/* $Id: d1_absyn.c,v 1.2 2002-10-22 13:19:50 adam Exp $
+/* $Id: d1_absyn.c,v 1.3 2002-12-02 16:55:14 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#define D1_MAX_NESTING 128
+struct data1_systag {
+ char *name;
+ char *value;
+ struct data1_systag *next;
+};
+
struct data1_absyn_cache_info
{
char *name;
return 0;
}
+const char *data1_systag_lookup(data1_absyn *absyn, const char *tag,
+ const char *default_value)
+{
+ struct data1_systag *p = absyn->systags;
+ for (; p; p = p->next)
+ if (!strcmp(p->name, tag))
+ return p->value;
+ return default_value;
+}
+
data1_absyn *data1_read_absyn (data1_handle dh, const char *file,
int file_must_exist)
{
data1_termlist *all = 0;
data1_attset_child **attset_childp;
data1_tagset **tagset_childp;
+ struct data1_systag **systagsp;
int level = 0;
int lineno = 0;
int argc;
res->tagset = 0;
res->encoding = 0;
res->enable_xpath_indexing = (f ? 0 : 1);
+ res->systags = 0;
+ systagsp = &res->systags;
tagset_childp = &res->tagset;
res->attset = data1_empty_attset (dh);
maptabp = &res->maptabs;
res->marc = 0;
marcp = &res->marc;
-
res->sub_elements = NULL;
res->main_elements = NULL;
}
res->encoding = nmem_strdup (data1_nmem_get(dh), argv[1]);
}
+ else if (!strcmp(cmd, "systag"))
+ {
+ struct data1_systag *st;
+ if (argc != 3)
+ {
+ yaz_log(LOG_WARN, "%s:%d: Bad # or args for systag",
+ file, lineno);
+ continue;
+ }
+ *systagsp = nmem_malloc (data1_nmem_get(dh), sizeof(**systagsp));
+
+ (*systagsp)->name = nmem_strdup(data1_nmem_get(dh), argv[1]);
+ (*systagsp)->value = nmem_strdup(data1_nmem_get(dh), argv[2]);
+ systagsp = &(*systagsp)->next;
+ }
else
{
yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'", file,
res->main_elements = cur_elements->elements;
fix_element_ref (dh, res, cur_elements->elements);
}
+ *systagsp = 0;
yaz_log (LOG_DEBUG, "%s: data1_read_absyn end", file);
return res;
}
recdA-0.mf: records/dino.xml
- zebraidx init
- zebraidx update records
+ ../../index/zebraidx init
+ ../../index/zebraidx update records
records/dino.xml: tree2xml.pl dino.tree
./tree2xml.pl dino.tree > records/dino.xml
tagset tagsetg-zthes.tag
tagset zthes.tag
xpath enable
+systag sysno none
elm (1,14) termId !
elm (2,1) termName !
-# $Id: zebra.cfg,v 1.3 2002-12-02 15:19:12 mike Exp $
+# $Id: zebra.cfg,v 1.4 2002-12-02 16:55:14 adam Exp $
profilePath: .:../../tab
recordType: grs.sgml
-tagsysno: 0
attset: zthes.att
-/* $Id: data1.h,v 1.2 2002-10-22 13:19:50 adam Exp $
+/* $Id: data1.h,v 1.3 2002-12-02 16:55:14 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
unsigned short what; /* DATA1I_text, .. see data1_node.u.data */
} data1_xattr;
+#if 0
+typedef struct data1_absyn data1_absyn;
+#else
typedef struct data1_absyn
{
char *name;
data1_marctab *marc;
data1_sub_elements *sub_elements;
data1_element *main_elements;
+ struct data1_systag *systags;
char *encoding;
int enable_xpath_indexing;
} data1_absyn;
-
+#endif
/*
* record data node (tag/data/variant)
*/
YAZ_EXPORT int data1_is_xmlmode(data1_handle dh);
+YAZ_EXPORT const char *data1_systag_lookup(data1_absyn *absyn, const char *tag,
+ const char *default_value);
+
YAZ_END_CDECL
#endif
-/* $Id: recgrs.c,v 1.69 2002-11-15 21:57:41 adam Exp $
+/* $Id: recgrs.c,v 1.70 2002-12-02 16:55:14 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
int res, selected = 0;
NMEM mem;
struct grs_read_info gri;
- char *tagname;
+ const char *tagname;
struct grs_handlers *h = (struct grs_handlers *) clientData;
int requested_schema = VAL_NONE;
data1_marctab *marctab;
top = data1_get_root_tag (p->dh, node);
logf (LOG_DEBUG, "grs_retrieve: size");
- if ((dnew = data1_mk_tag_data_wd(p->dh, top, "size", mem)))
+ tagname = data1_systag_lookup(node->u.root.absyn, "size", "size");
+ if (tagname &&
+ (dnew = data1_mk_tag_data_wd(p->dh, top, tagname, mem)))
{
dnew->u.data.what = DATA1I_text;
dnew->u.data.data = dnew->lbuf;
sprintf(dnew->u.data.data, "%d", p->recordSize);
dnew->u.data.len = strlen(dnew->u.data.data);
}
-
- tagname = res_get_def(p->res, "tagrank", "rank");
- if (strcmp(tagname, "0") && p->score >= 0 &&
+
+ tagname = data1_systag_lookup(node->u.root.absyn, "rank", "rank");
+ if (tagname && p->score >= 0 &&
(dnew = data1_mk_tag_data_wd(p->dh, top, tagname, mem)))
{
logf (LOG_DEBUG, "grs_retrieve: %s", tagname);
dnew->u.data.len = strlen(dnew->u.data.data);
}
- tagname = res_get_def(p->res, "tagsysno", "localControlNumber");
- if (strcmp(tagname, "0") && p->localno > 0 &&
- (dnew = data1_mk_tag_data_wd(p->dh, top, tagname, mem)))
+ tagname = data1_systag_lookup(node->u.root.absyn, "sysno",
+ "localControlNumber");
+ if (tagname && p->localno > 0 &&
+ (dnew = data1_mk_tag_data_wd(p->dh, top, tagname, mem)))
{
logf (LOG_DEBUG, "grs_retrieve: %s", tagname);
dnew->u.data.what = DATA1I_text;
dnew->u.data.data = dnew->lbuf;
-
+
sprintf(dnew->u.data.data, "%d", p->localno);
dnew->u.data.len = strlen(dnew->u.data.data);
}
# This is the abstract syntax (and most of the top-level profile info)
# for GILS version 2.
#
-# $Id: gils.abs,v 1.1 2002-10-22 12:51:09 adam Exp $
+# $Id: gils.abs,v 1.2 2002-12-02 16:55:14 adam Exp $
name gils
reference GILS-schema
esetname W gils-b.est # We don't really do bodyOfDisplay yet.
esetname F @
+systag sysno none
+
#all Any
elm (1,1) schemaIdentifier -