X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=index%2Fextract.c;h=5071fd74fbfae9a8c5f7a25d83fe43babda50017;hp=311ff36a29f0e6c34f33000fd0e56dfb7975ddf9;hb=e2e073b5c947e996304ed7d577497af5e9a879ee;hpb=629a83e117bdc40fbec9b3015c834dfa866c86ac diff --git a/index/extract.c b/index/extract.c index 311ff36..5071fd7 100644 --- a/index/extract.c +++ b/index/extract.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1994-2011 Index Data + Copyright (C) Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -1336,7 +1336,6 @@ void zebra_it_key_str_dump(ZebraHandle zh, struct it_key *key, const char *str, size_t slen, NMEM nmem, int level) { char keystr[200]; /* room for zints to print */ - char *dst_term = 0; int ord = CAST_ZINT_TO_INT(key->mem[0]); const char *index_type; int i; @@ -1345,8 +1344,6 @@ void zebra_it_key_str_dump(ZebraHandle zh, struct it_key *key, zebraExplain_lookup_ord(zh->reg->zei, ord, &index_type, 0/* db */, &string_index); assert(index_type); - zebra_term_untrans_iconv(zh, nmem, index_type, - &dst_term, str); *keystr = '\0'; for (i = 0; i < key->len; i++) { @@ -1375,11 +1372,23 @@ void zebra_it_key_str_dump(ZebraHandle zh, struct it_key *key, } yaz_log(level, "%s%s %s %s", keystr, index_type, string_index, dst_buf); - } else - yaz_log(level, "%s%s %s \"%s\"", keystr, index_type, - string_index, dst_term); + { + char *dst_term = 0; + zebra_term_untrans_iconv(zh, nmem, index_type, &dst_term, str); + if (dst_term) + yaz_log(level, "%s%s %s \"%s\"", keystr, index_type, + string_index, dst_term); + else + { + WRBUF w = wrbuf_alloc(); + wrbuf_write_escaped(w, str, strlen(str)); + yaz_log(level, "%s%s %s %s", keystr, index_type, + string_index, wrbuf_cstr(w)); + wrbuf_destroy(w); + } + } } void extract_rec_keys_log(ZebraHandle zh, int is_insert,