X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzebraapi.c;h=f709ee6508bd621a1b3bd4462fcfbec9551de805;hb=6ba2b233baf29688eb6e311f44a623890b604f3d;hp=10a49548963e15a067ee9e99c4c468e693627332;hpb=8174591e6c5c002acca0db83c4c46e1d0265a9e2;p=idzebra-moved-to-github.git diff --git a/index/zebraapi.c b/index/zebraapi.c index 10a4954..f709ee6 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.256 2007-05-21 11:54:59 adam Exp $ +/* $Id: zebraapi.c,v 1.266 2007-12-18 10:04:15 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -192,6 +192,8 @@ ZebraService zebra_start(const char *configName) ZebraService zebra_start_res(const char *configName, Res def_res, Res over_res) { Res res; + char version_str[16]; + char system_str[80]; zebra_flock_init(); @@ -201,7 +203,9 @@ ZebraService zebra_start_res(const char *configName, Res def_res, Res over_res) log_level_initialized = 1; } - yaz_log(YLOG_LOG, "zebra_start %s %s", ZEBRAVER, + zebra_get_version(version_str, system_str); + + yaz_log(YLOG_LOG, "zebra_start %s %s", version_str, configName ? configName : ""); if ((res = res_open(def_res, over_res))) @@ -415,10 +419,9 @@ struct zebra_register *zebra_register_open(ZebraService zs, const char *name, if (!strcmp (recordCompression, "bzip2")) record_compression = REC_COMPRESS_BZIP2; - if (1) { const char *index_fname = res_get_def(res, "index", "default.idx"); - if (index_fname && *index_fname) + if (index_fname && *index_fname && strcmp(index_fname, "none")) { if (zebra_maps_read_file(reg->zebra_maps, index_fname) != ZEBRA_OK) ret = ZEBRA_FAIL; @@ -1144,8 +1147,8 @@ ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream, hit_snippet); #endif recs[i].errCode = - zebra_record_fetch(zh, poset[i].sysno, poset[i].score, - hit_snippet, + zebra_record_fetch(zh, setname, + poset[i].sysno, poset[i].score, stream, input_format, comp, &recs[i].format, &buf, &len, &recs[i].base, &recs[i].errString); @@ -1221,7 +1224,6 @@ ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, const char *setname) { ZEBRA_RES res; - RSET limit_rset = 0; ZEBRA_CHECK_HANDLE(zh); @@ -1239,21 +1241,10 @@ ZEBRA_RES zebra_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, *num_entries = 0; return ZEBRA_FAIL; } - if (setname) - { - limit_rset = resultSetRef(zh, setname); - if (!limit_rset) - { - zebra_setError(zh, - YAZ_BIB1_SPECIFIED_RESULT_SET_DOES_NOT_EXIST, - setname); - zebra_end_read (zh); - return ZEBRA_FAIL; - } - } + res = rpn_scan(zh, stream, zapt, attributeset, zh->num_basenames, zh->basenames, position, - num_entries, entries, is_partial, limit_rset); + num_entries, entries, is_partial, setname); zebra_end_read(zh); return res; } @@ -1287,8 +1278,7 @@ int zebra_deleteResultSet(ZebraHandle zh, int function, { int i, status; ASSERTZH; - assert(statuses); - yaz_log(log_level, "zebra_deleteResultSet n=%d",num_setnames); + yaz_log(log_level, "zebra_deleteResultSet n=%d", num_setnames); if (zebra_begin_read(zh)) return Z_DeleteStatus_systemProblemAtTarget; @@ -1522,11 +1512,12 @@ ZEBRA_RES zebra_create_database (ZebraHandle zh, const char *db) return zebra_end_trans (zh); } -int zebra_string_norm(ZebraHandle zh, unsigned reg_id, +int zebra_string_norm(ZebraHandle zh, const char *index_type, const char *input_str, int input_len, char *output_str, int output_len) { WRBUF wrbuf; + zebra_map_t zm = zebra_map_get(zh->reg->zebra_maps, index_type); ASSERTZH; assert(input_str); assert(output_str); @@ -1534,8 +1525,7 @@ int zebra_string_norm(ZebraHandle zh, unsigned reg_id, if (!zh->reg->zebra_maps) return -1; - wrbuf = zebra_replace(zh->reg->zebra_maps, reg_id, "", - input_str, input_len); + wrbuf = zebra_replace(zm, "", input_str, input_len); if (!wrbuf) return -2; if (wrbuf_len(wrbuf) >= output_len)