From 2cf8341fde67a92369c46d9b12e6d056e5bc5a0e Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 19 Sep 2008 11:10:02 +0200 Subject: [PATCH] sort uses custom record ID if given / test_safari --- index/extract.c | 10 +++++++++- test/api/test_safari.c | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/index/extract.c b/index/extract.c index e092a9b..32b92ec 100644 --- a/index/extract.c +++ b/index/extract.c @@ -1873,13 +1873,14 @@ void extract_flush_sort_keys(ZebraHandle zh, zint sysno, int cmd; struct sort_add_ent *next; WRBUF wrbuf; + zint sysno; }; struct sort_add_ent *sort_ent_list = 0; - zebra_sort_sysno(si, sysno); while (zebra_rec_keys_read(reckeys, &str, &slen, &key_in)) { int ord = CAST_ZINT_TO_INT(key_in.mem[0]); + zint filter_sysno = key_in.mem[1]; struct sort_add_ent **e = &sort_ent_list; while (*e && (*e)->ord != ord) @@ -1891,6 +1892,7 @@ void extract_flush_sort_keys(ZebraHandle zh, zint sysno, (*e)->wrbuf = wrbuf_alloc(); (*e)->ord = ord; (*e)->cmd = cmd; + (*e)->sysno = filter_sysno ? filter_sysno : sysno; } wrbuf_write((*e)->wrbuf, str, slen); @@ -1898,9 +1900,15 @@ void extract_flush_sort_keys(ZebraHandle zh, zint sysno, } if (sort_ent_list) { + zint last_sysno = 0; struct sort_add_ent *e = sort_ent_list; for (; e; e = e->next) { + if (last_sysno != e->sysno) + { + zebra_sort_sysno(si, e->sysno); + last_sysno = e->sysno; + } zebra_sort_type(si, e->ord); if (e->cmd == 1) zebra_sort_add(si, e->wrbuf); diff --git a/test/api/test_safari.c b/test/api/test_safari.c index e1df1bb..0751368 100644 --- a/test/api/test_safari.c +++ b/test/api/test_safari.c @@ -131,7 +131,9 @@ static void tst(int argc, char **argv) yaz_oid_recsyn_xml, "\n" " \n" - /* something is missing here! */ + " a b c\n" + " j k l\n" + " m n o\n" " \n" "\n"), ZEBRA_OK); -- 1.7.10.4