X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzrpn.c;h=a1eb701e2e06e63b5bc363383ea9b49123a8ef19;hb=732e272a6d35533ccc89f4ccab0ea8069097b8a1;hp=40815ac0af0d8f6dc233f8c7e9e2c2263b550f5c;hpb=4e62ee01de32fadf7036b0a6aa61a76528f6e3e0;p=idzebra-moved-to-github.git diff --git a/index/zrpn.c b/index/zrpn.c index 40815ac..a1eb701 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,4 +1,4 @@ -/* $Id: zrpn.c,v 1.129 2003-02-27 11:29:13 adam Exp $ +/* $Id: zrpn.c,v 1.132 2003-03-31 22:14:18 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -1300,7 +1300,7 @@ static RSET rpn_prox (ZebraHandle zh, RSET *rset, int rset_no, parms.temp_path = res_get (zh->res, "setTmpDir"); result = rset_create (rset_kind_temp, &parms); rsfd_result = rset_open (result, RSETF_WRITE); - + while (*more) { for (i = 1; inn = min_nn; @@ -2100,12 +2101,11 @@ struct xpath_location_step { static int parse_xpath(ZebraHandle zh, Z_AttributesPlusTerm *zapt, oid_value attributeSet, - struct xpath_location_step *xpath, NMEM mem) + struct xpath_location_step *xpath, int max, NMEM mem) { oid_value curAttributeSet = attributeSet; AttrType use; const char *use_string = 0; - int no = 0; attr_init (&use, zapt, 1); attr_find_ex (&use, &curAttributeSet, &use_string); @@ -2113,7 +2113,7 @@ static int parse_xpath(ZebraHandle zh, Z_AttributesPlusTerm *zapt, if (!use_string || *use_string != '/') return -1; - return (parse_xpath_str(use_string, xpath, mem)); + return zebra_parse_xpath_str(use_string, xpath, max, mem); } @@ -2352,7 +2352,7 @@ static RSET rpn_search_APT (ZebraHandle zh, Z_AttributesPlusTerm *zapt, if (sort_flag) return rpn_sort_spec (zh, zapt, attributeSet, stream, sort_sequence, rank_type); - xpath_len = parse_xpath(zh, zapt, attributeSet, xpath, stream); + xpath_len = parse_xpath(zh, zapt, attributeSet, xpath, 10, stream); if (xpath_len >= 0) { xpath_use = 1016; @@ -2500,6 +2500,8 @@ static RSET rpn_search_structure (ZebraHandle zh, Z_RPNStructure *zs, nmem_strdup (stream, zs->u.simple->u.resultSetId); return 0; } + else + rset_dup(r); } else { @@ -2660,7 +2662,7 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, oid_value attributeset, int num_bases, char **basenames, int *position, int *num_entries, ZebraScanEntry **list, - int *is_partial) + int *is_partial, RSET limit_set, int return_zero) { int i; int pos = *position; @@ -2681,11 +2683,38 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, char rank_type[128]; int complete_flag; int sort_flag; + *list = 0; if (attributeset == VAL_NONE) attributeset = VAL_BIB1; + if (!limit_set) + { + AttrType termset; + int termset_value_numeric; + const char *termset_value_string; + attr_init (&termset, zapt, 8); + termset_value_numeric = + attr_find_ex (&termset, NULL, &termset_value_string); + if (termset_value_numeric != -1) + { + char resname[32]; + const char *termset_name = 0; + + if (termset_value_numeric != -2) + { + + sprintf (resname, "%d", termset_value_numeric); + termset_name = resname; + } + else + termset_name = termset_value_string; + + limit_set = resultSetRef (zh, termset_name); + } + } + yaz_log (LOG_DEBUG, "position = %d, num = %d set=%d", pos, num, attributeset); @@ -2842,6 +2871,17 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, ptr[j]++; } } + if (limit_set) + { + rset_bool_parms bool_parms; + + bool_parms.key_size = sizeof(struct it_key); + bool_parms.cmp = key_compare_it; + bool_parms.rset_l = rset; + bool_parms.rset_r = rset_dup(limit_set); + + rset = rset_create (rset_kind_and, &bool_parms); + } count_set (rset, &glist[i+before].occurrences); rset_delete (rset); } @@ -2910,6 +2950,17 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, ptr[j]++; } } + if (limit_set) + { + rset_bool_parms bool_parms; + + bool_parms.key_size = sizeof(struct it_key); + bool_parms.cmp = key_compare_it; + bool_parms.rset_l = rset; + bool_parms.rset_r = rset_dup(limit_set); + + rset = rset_create (rset_kind_and, &bool_parms); + } count_set (rset, &glist[before-1-i].occurrences); rset_delete (rset); }