X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzebraapi.c;h=d1bf1a4bab61bef1d0540d14c912dac007062f51;hb=1cc0116831e49bf70538639a8fc9b08b9524c683;hp=3d9d89f246a9de2427fd4fd41cc5af20b12d4776;hpb=13bf0c380e98816595127291b64368dd9b8ca639;p=idzebra-moved-to-github.git diff --git a/index/zebraapi.c b/index/zebraapi.c index 3d9d89f..d1bf1a4 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.128 2004-09-03 14:59:49 heikki Exp $ +/* $Id: zebraapi.c,v 1.130 2004-09-09 10:41:42 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -196,6 +196,25 @@ void zebra_pidfname(ZebraService zs, char *path) strcat(path, "zebrasrv.pid"); } +Dict dict_open_res (BFiles bfs, const char *name, int cache, int rw, + int compact_flag, Res res) +{ + int page_size = 4096; + char resource_str[200]; + const char *v; + sprintf (resource_str, "dict.%.100s.pagesize", name); + + v = res_get(res, resource_str); + if (v) + { + page_size = atoi(v); + yaz_log(LOG_LOG, "Using custom dictionary page size %d for %s", + page_size, name); + } + return dict_open(bfs, name, cache, rw, compact_flag, page_size); +} + + static struct zebra_register *zebra_register_open (ZebraService zs, const char *name, int rw, int useshadow, Res res, @@ -286,9 +305,9 @@ struct zebra_register *zebra_register_open (ZebraService zs, const char *name, } if (rw) { - reg->matchDict = dict_open (reg->bfs, GMATCH_DICT, 20, 1, 0); + reg->matchDict = dict_open_res (reg->bfs, GMATCH_DICT, 20, 1, 0, res); } - if (!(reg->dict = dict_open (reg->bfs, FNAME_DICT, 40, rw, 0))) + if (!(reg->dict = dict_open_res (reg->bfs, FNAME_DICT, 40, rw, 0, res))) { logf (LOG_WARN, "dict_open"); return 0; @@ -1732,6 +1751,8 @@ int zebra_init (ZebraHandle zh) bfs = bfs_create (res_get (zh->service->global_res, "register"), zh->path_reg); + if (!bfs) + return -1; if (rval && *rval) bf_cache (bfs, rval);