From c9074a8094fd1a1b8cde9355bc75e0812e5ab88b Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 5 Mar 2008 09:21:48 +0000 Subject: [PATCH] Added new tuning paramters for facets. Two new tuning parameters for facets are available. 'facetNumRecs' specifies how maximum number of records to be analyzed in a result set. 'facetMaxChunks' specifies how maximum number of sub record chunks to be fetched and analyzed per record. --- index/check_res.c | 5 +++-- index/retrieve.c | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/index/check_res.c b/index/check_res.c index b508f72..7b41f3a 100644 --- a/index/check_res.c +++ b/index/check_res.c @@ -1,4 +1,4 @@ -/* $Id: check_res.c,v 1.8 2007-11-06 10:29:59 adam Exp $ +/* $Id: check_res.c,v 1.9 2008-03-05 09:21:48 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -72,7 +72,8 @@ int zebra_check_res(Res res) res_add(v, "storeKeys", "p"); res_add(v, "storeData", "p"); res_add(v, "openRW", "p"); - + res_add(v, "facetNumRecs", ""); + res_add(v, "facetMaxChunks", ""); errors = res_check(res, v); diff --git a/index/retrieve.c b/index/retrieve.c index 175a1ab..7dc82b8 100644 --- a/index/retrieve.c +++ b/index/retrieve.c @@ -1,4 +1,4 @@ -/* $Id: retrieve.c,v 1.84 2008-01-24 16:17:29 adam Exp $ +/* $Id: retrieve.c,v 1.85 2008-03-05 09:21:48 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -49,7 +49,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 +76,7 @@ static int zebra_create_record_stream(ZebraHandle zh, } return 0; } - + struct index_spec { const char *index_name; @@ -720,16 +721,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 +809,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_LOG, "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 +820,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_LOG, "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)) -- 1.7.10.4