X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=index%2Fzebraapi.c;h=65b91764a3672c81dd4b773bec8494a4e56e792b;hp=7e2382da30e8b71b648ae7d720f327191abff8d6;hb=d71149439012fadf092321e3b507d23711715743;hpb=c1b2004dece42eba1b3d79c34bcbf7cac4ba2092 diff --git a/index/zebraapi.c b/index/zebraapi.c index 7e2382d..65b9176 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -69,7 +69,7 @@ static int zebra_chdir(ZebraService zs) yaz_log(log_level, "zebra_chdir"); dir = res_get(zs->global_res, "chdir"); if (!dir) - return; + return 0; yaz_log(YLOG_DEBUG, "chdir %s", dir); #ifdef WIN32 r = _chdir(dir); @@ -334,7 +334,7 @@ struct zebra_register *zebra_register_open(ZebraService zs, const char *name, { struct zebra_register *reg; int record_compression = REC_COMPRESS_NONE; - const char *recordCompression = 0; + const char *compression_str = 0; const char *profilePath; int sort_type = ZEBRA_SORT_TYPE_FLAT; ZEBRA_RES ret = ZEBRA_OK; @@ -420,11 +420,18 @@ struct zebra_register *zebra_register_open(ZebraService zs, const char *name, zebraRankInstall(reg, rank_similarity_class); zebraRankInstall(reg, rank_static_class); - recordCompression = res_get_def(res, "recordCompression", "none"); - if (!strcmp(recordCompression, "none")) + compression_str = res_get_def(res, "compression_str", "none"); + if (!strcmp(compression_str, "none")) record_compression = REC_COMPRESS_NONE; - if (!strcmp(recordCompression, "bzip2")) + else if (!strcmp(compression_str, "bzip2")) record_compression = REC_COMPRESS_BZIP2; + else if (!strcmp(compression_str, "zlib")) + record_compression = REC_COMPRESS_ZLIB; + else + { + yaz_log(YLOG_FATAL, "invalid recordCompression: %s", compression_str); + ret = ZEBRA_FAIL; + } { const char *index_fname = res_get_def(res, "index", "default.idx"); @@ -1634,7 +1641,7 @@ static void zebra_get_state(ZebraHandle zh, char *val, int *seqno) if (f) { - if (fscanf(f, "%c %d", val, seqno)) + if (fscanf(f, "%c %d", val, seqno) != 2) { yaz_log(YLOG_ERRNO|YLOG_WARN, "fscan fail %s", state_fname);