X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fretrieve.c;h=f4faf45b7339f773cf7458fe341ea08570298576;hb=ce556bc293c5eed60090acaf82cc668d333abd7b;hp=175a1abb22b01d3c53d11520f21075a096885bd0;hpb=2f90c38b8537b48fc38a343748d03d5354029b50;p=idzebra-moved-to-github.git diff --git a/index/retrieve.c b/index/retrieve.c index 175a1ab..f4faf45 100644 --- a/index/retrieve.c +++ b/index/retrieve.c @@ -1,8 +1,5 @@ -/* $Id: retrieve.c,v 1.84 2008-01-24 16:17:29 adam Exp $ - Copyright (C) 1995-2007 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) 1995-2008 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 @@ -49,7 +46,8 @@ static int zebra_create_record_stream(ZebraHandle zh, { RecordAttr *recordAttr = rec_init_attr(zh->reg->zei, *rec); - if ((*rec)->size[recInfo_storeData] > 0) + if ((*rec)->size[recInfo_storeData] > 0 + || (*rec)->info[recInfo_filename] == 0) zebra_create_stream_mem(stream, (*rec)->info[recInfo_storeData], (*rec)->size[recInfo_storeData]); else @@ -75,7 +73,7 @@ static int zebra_create_record_stream(ZebraHandle zh, } return 0; } - + struct index_spec { const char *index_name; @@ -720,16 +718,19 @@ static ZEBRA_RES facet_fetch(ZebraHandle zh, const char *setname, zint *pos_array; int i; int num_recs = 10; /* number of records to analyze */ + int max_chunks = 2; ZebraMetaRecord *poset; ZEBRA_RES ret = ZEBRA_OK; int *ord_array; WRBUF wr = wrbuf_alloc(); int use_xml = 0; - int no_ord = 0; struct index_spec *spec, *spec_list; int error; + res_get_int(zh->res, "facetNumRecs", &num_recs); + res_get_int(zh->res, "facetMaxChunks", &max_chunks); + /* see if XML is required for response */ if (oid_oidcmp(input_format, yaz_oid_recsyn_xml) == 0) use_xml = 1; @@ -805,7 +806,9 @@ static ZEBRA_RES facet_fetch(ZebraHandle zh, const char *setname, poset[i].sysno, sysnos, &no_sysnos); assert(no_sysnos > 0); - for (j = 0; j < no_sysnos; j++) + yaz_log(YLOG_DEBUG, "Analyzing rec=%d ISAM sysno=" ZINT_FORMAT " chunks=%d", + i, poset[i].sysno, no_sysnos); + for (j = 0; j < no_sysnos && j < max_chunks; j++) { size_t slen; const char *str; @@ -814,7 +817,9 @@ static ZEBRA_RES facet_fetch(ZebraHandle zh, const char *setname, zebra_rec_keys_t keys = zebra_rec_keys_open(); zebra_rec_keys_set_buf(keys, rec->info[recInfo_delKeys], rec->size[recInfo_delKeys], 0); - + + yaz_log(YLOG_DEBUG, "rec %d " ZINT_FORMAT " %s", + j, sysnos[j], zebra_rec_keys_empty(keys) ? "empty" : "non-empty"); if (zebra_rec_keys_rewind(keys)) { while (zebra_rec_keys_read(keys, &str, &slen, &key_in))