X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fupdate_file.c;h=7b211c0fb36da33f0d4fa5486d752824f5f5bc11;hb=9eaf65aa25be411fbd6298292f5ad7a7df7083ed;hp=aaeca2dcaec80c86fff4ce54e6656d458b74af64;hpb=4478d785b7769691261005c98063b98a5a5971b3;p=idzebra-moved-to-github.git diff --git a/index/update_file.c b/index/update_file.c index aaeca2d..7b211c0 100644 --- a/index/update_file.c +++ b/index/update_file.c @@ -1,4 +1,4 @@ -/* $Id: update_file.c,v 1.2 2006-08-14 10:40:15 adam Exp $ +/* $Id: update_file.c,v 1.3 2006-09-11 22:57:54 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -297,15 +297,47 @@ static void file_update_top(ZebraHandle zh, Dict dict, const char *path) } } -ZEBRA_RES zebra_update_file_match(ZebraHandle zh, const char *path) +static ZEBRA_RES zebra_open_fmatch(ZebraHandle zh, Dict *dictp) { - Dict dict; - if (!(dict = dict_open_res (zh->reg->bfs, FMATCH_DICT, 50, + char fmatch_fname[1024]; + int ord; + + ord = zebraExplain_get_database_ord(zh->reg->zei); + sprintf(fmatch_fname, FMATCH_DICT, ord); + if (!(*dictp = dict_open_res (zh->reg->bfs, fmatch_fname, 50, zh->m_flag_rw, 0, zh->res))) { - yaz_log (YLOG_FATAL, "dict_open fail of %s", FMATCH_DICT); + yaz_log (YLOG_FATAL, "dict_open fail of %s", fmatch_fname); return ZEBRA_FAIL; } + return ZEBRA_OK; +} + +ZEBRA_RES zebra_remove_file_match(ZebraHandle zh) +{ + Dict dict; + + if (zebra_open_fmatch(zh, &dict) != ZEBRA_OK) + return ZEBRA_FAIL; + + dict_clean(dict); + dict_close(dict); + + return ZEBRA_OK; +} + +ZEBRA_RES zebra_update_file_match(ZebraHandle zh, const char *path) +{ + Dict dict; + + if (zebraExplain_curDatabase (zh->reg->zei, zh->basenames[0])) + { + if (zebraExplain_newDatabase(zh->reg->zei, zh->basenames[0], 0)) + return ZEBRA_FAIL; + } + if (zebra_open_fmatch(zh, &dict) != ZEBRA_OK) + return ZEBRA_FAIL; + if (!strcmp(path, "") || !strcmp(path, "-")) { char src[1024];