X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=index%2Fzinfo.c;h=72245838cd03a35dbc3427e13b42d293ecc87078;hp=5c1b7df0b9f51b86b7ae776448820bfe2d2a99f6;hb=1ccf2613ceef2359f589cb3dd7e72a899c618b2f;hpb=c41c84a497ae744aa825a90f144c85b54f1cd4bb diff --git a/index/zinfo.c b/index/zinfo.c index 5c1b7df..7224583 100644 --- a/index/zinfo.c +++ b/index/zinfo.c @@ -1,10 +1,20 @@ /* - * Copyright (C) 1994-1999, Index Data + * Copyright (C) 1994-2000, Index Data * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: zinfo.c,v $ - * Revision 1.18 2000-03-20 19:08:36 adam + * Revision 1.21 2000-12-05 10:01:44 adam + * Fixed bug regarding user-defined attribute sets. + * + * Revision 1.20 2000/11/29 14:24:01 adam + * Script configure uses yaz pthreads options. Added locking for + * zebra_register_{lock,unlock}. + * + * Revision 1.19 2000/07/07 12:49:20 adam + * Optimized resultSetInsert{Rank,Sort}. + * + * Revision 1.18 2000/03/20 19:08:36 adam * Added remote record import using Z39.50 extended services and Segment * Requests. * @@ -183,16 +193,11 @@ static data1_node *data1_add_tag (data1_handle dh, data1_node *at, const char *tag, NMEM nmem) { data1_node *partag = get_parent_tag(dh, at); - data1_node *res = data1_mk_node (dh, nmem); + data1_node *res = data1_mk_node_type (dh, nmem, DATA1N_tag); data1_element *e = NULL; res->parent = at; - res->which = DATA1N_tag; res->u.tag.tag = data1_insert_string (dh, res, nmem, tag); - res->u.tag.node_selected = 0; - res->u.tag.make_variantlist = 0; - res->u.tag.no_data_requested = 0; - res->u.tag.get_bytes = -1; if (partag) e = partag->u.tag.element; @@ -492,16 +497,19 @@ ZebraExplainInfo zebraExplain_open ( zdip = &zei->databaseInfo; trec = rec_get (records, 1); /* get "root" record */ + zei->ordinalSU = 1; + zei->runNumber = 0; + zebraExplain_mergeAccessInfo (zei, 0, &zei->accessInfo); if (trec) /* targetInfo already exists ... */ { data1_node *node_tgtinfo, *node_zebra, *node_list, *np; zei->data1_target = read_sgml_rec (zei->dh, zei->nmem, trec); - if (!zei->data1_target) + if (!zei->data1_target || !zei->data1_target->u.root.absyn) { - rec_rm (&trec); - nmem_destroy(zei->nmem); + logf (LOG_FATAL, "Explain schema missing. Check profilePath"); + nmem_destroy (zei->nmem); return 0; } #if ZINFO_DEBUG @@ -514,9 +522,15 @@ ZebraExplainInfo zebraExplain_open ( node_zebra = data1_search_tag (zei->dh, node_tgtinfo->child, "zebraInfo"); - node_list = data1_search_tag (zei->dh, node_zebra->child, - "databaseList"); - for (np = node_list->child; np; np = np->next) + np = 0; + if (node_zebra) + { + node_list = data1_search_tag (zei->dh, node_zebra->child, + "databaseList"); + if (node_list) + np = node_list->child; + } + for (; np; np = np->next) { data1_node *node_name = NULL; data1_node *node_id = NULL; @@ -563,25 +577,26 @@ ZebraExplainInfo zebraExplain_open ( zdip = &(*zdip)->next; } - np = data1_search_tag (zei->dh, node_zebra->child, - "ordinalSU"); - np = np->child; - assert (np && np->which == DATA1N_data); - zei->ordinalSU = atoi_n (np->u.data.data, np->u.data.len); - - np = data1_search_tag (zei->dh, node_zebra->child, - "runNumber"); - np = np->child; - assert (np && np->which == DATA1N_data); - zei->runNumber = atoi_n (np->u.data.data, np->u.data.len); - *zdip = NULL; + if (node_zebra) + { + np = data1_search_tag (zei->dh, node_zebra->child, + "ordinalSU"); + np = np->child; + assert (np && np->which == DATA1N_data); + zei->ordinalSU = atoi_n (np->u.data.data, np->u.data.len); + + np = data1_search_tag (zei->dh, node_zebra->child, + "runNumber"); + np = np->child; + assert (np && np->which == DATA1N_data); + zei->runNumber = atoi_n (np->u.data.data, np->u.data.len); + *zdip = NULL; + } rec_rm (&trec); } else /* create initial targetInfo */ { data1_node *node_tgtinfo; - zei->ordinalSU = 1; - zei->runNumber = 0; *zdip = NULL; if (writeFlag) @@ -597,9 +612,9 @@ ZebraExplainInfo zebraExplain_open ( "1\n" "Zebra\n" "\n" ); - - if (!zei->data1_target) + if (!zei->data1_target || !zei->data1_target->u.root.absyn) { + logf (LOG_FATAL, "Explain schema missing. Check profilePath"); nmem_destroy (zei->nmem); return 0; } @@ -750,7 +765,7 @@ static void zebraExplain_readDatabase (ZebraExplainInfo zei, { zdi->recordCount = atoi_n (np->child->u.data.data, np->child->u.data.len); - } + } zdi->readFlag = 0; rec_rm (&rec); }