X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzebraapi.c;h=d23f8ca2f6f28070d4d2f2ef4a878463982fabe0;hb=d0d4772450cfe6afde24ed8ec4031afd2da56632;hp=343c89d55d062b122e2b1ed7c6f1523112c8800a;hpb=ce0c8ffd1c3471504b638f6b47a0e85bf1b6f24f;p=idzebra-moved-to-github.git diff --git a/index/zebraapi.c b/index/zebraapi.c index 343c89d..d23f8ca 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,25 @@ 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, "recordCompression", "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; + } + + if (!rec_check_compression_method(record_compression)) + { + yaz_log(YLOG_FATAL, "unsupported recordCompression: %s", + compression_str); + ret = ZEBRA_FAIL; + } { const char *index_fname = res_get_def(res, "index", "default.idx");