X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=index%2Fzebraapi.c;h=45292943f0710edfcab13152eeca8e2cdf21cbd2;hb=55f7753517be121c50701a923dc638b5a8f3be5e;hp=b8965cd7d116bd787ca04fe74ff278bb541be1ac;hpb=ef144bcc0523415f8ce2fd5d92db86043c2c1c7d;p=idzebra-moved-to-github.git diff --git a/index/zebraapi.c b/index/zebraapi.c index b8965cd..4529294 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.73 2002-09-17 12:27:12 adam Exp $ +/* $Id: zebraapi.c,v 1.81 2003-01-15 07:26:40 oleg Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -84,7 +84,7 @@ ZebraHandle zebra_open (ZebraService zs) zh->destroyed = 0; zh->errCode = 0; zh->errString = 0; - zh->res = 0; + zh->res = 0; zh->reg_name = xstrdup (""); zh->path_reg = 0; @@ -193,7 +193,8 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, } if (useshadow) bf_cache (reg->bfs, res_get (res, "shadow")); - data1_set_tabpath (reg->dh, res_get(res, "profilePath")); + data1_set_tabpath (reg->dh, res_get_def(res, "profilePath", + DEFAULT_PROFILE_PATH)); data1_set_tabroot (reg->dh, reg_path); reg->recTypes = recTypes_init (reg->dh); recTypes_default_handlers (reg->recTypes); @@ -217,6 +218,7 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, reg->isamb = 0; reg->zei = 0; reg->matchDict = 0; + reg->key_file_no = 0; zebraRankInstall (reg, rank1_class); @@ -389,14 +391,11 @@ void zebra_stop(ZebraService zs) return ; yaz_log (LOG_LOG, "zebra_stop"); - zebra_mutex_cond_lock (&zs->session_lock); while (zs->sessions) { zebra_close (zs->sessions); } - zebra_mutex_cond_unlock (&zs->session_lock); - zebra_mutex_cond_destroy (&zs->session_lock); if (zs->passwd_db) @@ -449,8 +448,6 @@ void zebra_close (ZebraHandle zh) } sp = &(*sp)->next; } -// if (!zs->sessions && zs->stop_flag) -// zebra_register_deactivate(zs); zebra_mutex_cond_unlock (&zs->session_lock); xfree (zh->reg_name); xfree (zh); @@ -574,7 +571,7 @@ void map_basenames_func (void *vp, const char *name, const char *value) return ; no--; for (i = 0; inum_bases; i++) - if (p->basenames[i] && !strcmp (p->basenames[i], fromdb)) + if (p->basenames[i] && !STRCASECMP (p->basenames[i], fromdb)) { p->basenames[i] = 0; for (i = 0; i < no; i++) @@ -1227,7 +1224,6 @@ void zebra_end_trans (ZebraHandle zh) zebra_register_close (zh->service, zh->reg); zh->reg = 0; - yaz_log (LOG_LOG, "Records: %7d i/u/d %d/%d/%d", zh->records_processed, zh->records_inserted, zh->records_updated, zh->records_deleted); @@ -1400,6 +1396,39 @@ void zebra_shadow_enable (ZebraHandle zh, int value) int zebra_record_encoding (ZebraHandle zh, const char *encoding) { xfree (zh->record_encoding); + + /* + * Fixme! + */ + + if (zh->iconv_to_utf8 != 0) + yaz_iconv_close(zh->iconv_to_utf8); + if (zh->iconv_from_utf8 != 0) + yaz_iconv_close(zh->iconv_from_utf8); + zh->record_encoding = xstrdup (encoding); + + logf(LOG_DEBUG, "Reset record encoding: %s", encoding); + + zh->iconv_to_utf8 = + yaz_iconv_open ("UTF-8", encoding); + if (zh->iconv_to_utf8 == 0) + yaz_log (LOG_WARN, "iconv: %s to UTF-8 unsupported", encoding); + zh->iconv_from_utf8 = + yaz_iconv_open (encoding, "UTF-8"); + if (zh->iconv_to_utf8 == 0) + yaz_log (LOG_WARN, "iconv: UTF-8 to %s unsupported", encoding); + return 0; } + +void zebra_set_resource(ZebraHandle zh, const char *name, const char *value) +{ + res_put(zh->res, name, value); +} + +const char *zebra_get_resource(ZebraHandle zh, + const char *name, const char *defaultvalue) +{ + return res_get_def( zh->res, name, (char *)defaultvalue); +}