X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Frpnsearch.c;h=95295737a0e4eab04fffd6b8f9b3e206a91c3f9f;hb=6b553b7b42f0a2940c9765b9811e5db44ba8265f;hp=909e9cc7bcdd7066082dc3220cec6f8ec134b3e5;hpb=1ab2b4589da1d33372cc1f9a87afdac160ca11de;p=idzebra-moved-to-github.git diff --git a/index/rpnsearch.c b/index/rpnsearch.c index 909e9cc..9529573 100644 --- a/index/rpnsearch.c +++ b/index/rpnsearch.c @@ -1,4 +1,4 @@ -/* $Id: rpnsearch.c,v 1.1 2006-09-21 08:56:52 adam Exp $ +/* $Id: rpnsearch.c,v 1.3 2006-11-30 10:33:19 adam Exp $ Copyright (C) 1995-2006 Index Data ApS @@ -734,6 +734,10 @@ static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt, *term_tmp++ = '['; *term_tmp++ = '^'; + + *term_tmp++ = 1; + *term_tmp++ = FIRST_IN_FIELD_CHAR; + string_rel_add_char(&term_tmp, term_component, &i); *term_tmp++ = '-'; @@ -746,6 +750,7 @@ static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt, } *term_tmp++ = ')'; *term_tmp = '\0'; + yaz_log(YLOG_LOG, "term_dict=%s", term_dict); break; case 2: if (!term_100(zh->reg->zebra_maps, reg_type, @@ -764,6 +769,10 @@ static int string_relation(ZebraHandle zh, Z_AttributesPlusTerm *zapt, *term_tmp++ = '['; *term_tmp++ = '^'; + + *term_tmp++ = 1; + *term_tmp++ = FIRST_IN_FIELD_CHAR; + string_rel_add_char(&term_tmp, term_component, &i); *term_tmp++ = '-'; @@ -2309,6 +2318,37 @@ static ZEBRA_RES rpn_search_structure(ZebraHandle zh, Z_RPNStructure *zs, Z_Operator *parent_op, struct rset_key_control *kc); +ZEBRA_RES rpn_get_top_approx_limit(ZebraHandle zh, Z_RPNStructure *zs, + zint *approx_limit) +{ + ZEBRA_RES res = ZEBRA_OK; + if (zs->which == Z_RPNStructure_complex) + { + if (res == ZEBRA_OK) + res = rpn_get_top_approx_limit(zh, zs->u.complex->s1, + approx_limit); + if (res == ZEBRA_OK) + res = rpn_get_top_approx_limit(zh, zs->u.complex->s2, + approx_limit); + } + else if (zs->which == Z_RPNStructure_simple) + { + if (zs->u.simple->which == Z_Operand_APT) + { + Z_AttributesPlusTerm *zapt = zs->u.simple->u.attributesPlusTerm; + AttrType global_hits_limit_attr; + int l; + + attr_init_APT(&global_hits_limit_attr, zapt, 12); + + l = attr_find(&global_hits_limit_attr, NULL); + if (l != -1) + *approx_limit = l; + } + } + return res; +} + ZEBRA_RES rpn_search_top(ZebraHandle zh, Z_RPNStructure *zs, oid_value attributeSet, NMEM stream, NMEM rset_nmem,