X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=index%2Fzebraapi.c;h=40aa1cc7cfcd33aa190c7df606232be97af042e5;hb=be0203ee07adfeda7821a2c44ba6dd31a532b792;hp=59956109607cdefe2595faeaffce70e2c408a044;hpb=aa7cc3c1655c632a7b3a7053fb5b46b8ce0d3aeb;p=idzebra-moved-to-github.git diff --git a/index/zebraapi.c b/index/zebraapi.c index 5995610..40aa1cc 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.180 2005-08-09 09:35:25 adam Exp $ +/* $Id: zebraapi.c,v 1.184 2005-08-22 09:04:18 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -126,6 +126,7 @@ ZebraHandle zebra_open (ZebraService zs) zh->lock_shadow = 0; zh->shadow_enable = 1; + zh->m_staticrank = 0; default_encoding = res_get_def(zs->global_res, "encoding", "ISO-8859-1"); @@ -172,9 +173,9 @@ ZebraService zebra_start_res (const char *configName, Res def_res, Res over_res) log_level = yaz_log_module_level("zebraapi"); log_level_initialized = 1; } - - yaz_log(YLOG_LOG, "zebra_start %s %s",configName, ZEBRAVER); - assert(configName); + + yaz_log(YLOG_LOG, "zebra_start %s %s", ZEBRAVER, + configName ? configName : ""); if ((res = res_open (configName, def_res, over_res))) { @@ -182,10 +183,7 @@ ZebraService zebra_start_res (const char *configName, Res def_res, Res over_res) const char *passwd_encrypt = 0; ZebraService zh = xmalloc(sizeof(*zh)); - yaz_log (YLOG_DEBUG, "Read resources `%s'", configName); - zh->global_res = res; - zh->configName = xstrdup(configName); zh->sessions = 0; zebra_chdir (zh); @@ -332,8 +330,9 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, reg->key_file_no = 0; reg->ptr_i = 0; - zebraRankInstall (reg, rank1_class); - zebraRankInstall (reg, rankzv_class); + zebraRankInstall (reg, rank_1_class); + zebraRankInstall (reg, rank_zv_class); + zebraRankInstall (reg, rank_static_class); recordCompression = res_get_def (res, "recordCompression", "none"); if (!strcmp (recordCompression, "none")) @@ -511,7 +510,6 @@ ZEBRA_RES zebra_stop(ZebraService zs) recTypeClass_destroy(zs->record_classes); nmem_destroy(zs->nmem); res_close (zs->global_res); - xfree(zs->configName); xfree(zs); return ZEBRA_OK; } @@ -703,6 +701,13 @@ static void zebra_select_register (ZebraHandle zh, const char *new_reg) if (res_get_int(zh->res, "estimatehits", &approx) == ZEBRA_OK) zebra_set_approx_limit(zh, approx); } + if (zh->res) + { + if (res_get_int(zh->res, "staticrank", &zh->m_staticrank) == ZEBRA_OK) + yaz_log(YLOG_LOG, "static rank set and is %d", zh->m_staticrank); + else + yaz_log(YLOG_LOG, "static rank unset"); + } } void map_basenames_func (void *vp, const char *name, const char *value) @@ -1234,13 +1239,13 @@ ZEBRA_RES zebra_admin_import_segment (ZebraHandle zh, Z_Segment *segment) Odr_oct *oct = fragment->u.notExternallyTagged; sysno = 0; - if ( zebra_update_record(zh, - 0, /* record Type */ - &sysno, - 0, /* match */ - 0, /* fname */ - oct->buf, oct->len, - 0) == ZEBRA_FAIL) + if (zebra_update_record(zh, + 0, /* record Type */ + &sysno, + 0, /* match */ + 0, /* fname */ + (const char *) oct->buf, oct->len, + 0) == ZEBRA_FAIL) res = ZEBRA_FAIL; } } @@ -2036,7 +2041,6 @@ const char *zebra_get_resource(ZebraHandle zh, const char *v; ASSERTZH; assert(name); - assert(defaultvalue); v = res_get_def (zh->res, name, (char *)defaultvalue); zebra_clearError(zh); yaz_log(log_level, "zebra_get_resource %s:%s", name, v);