X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzrpn.c;h=758608b7851b558ea944dbd09d9219f2e4e35bb8;hb=71ef94163cc848e4ed12965238087d2505c42c05;hp=476990c932b3672fd58664a08cae8153d1abc2d4;hpb=4e0c3427c48f694de513318f2bd6d3470428fc88;p=idzebra-moved-to-github.git diff --git a/index/zrpn.c b/index/zrpn.c index 476990c..758608b 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,4 +1,4 @@ -/* $Id: zrpn.c,v 1.169 2005-02-25 10:08:44 adam Exp $ +/* $Id: zrpn.c,v 1.170 2005-03-05 09:19:15 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -206,7 +206,7 @@ static void term_untrans(ZebraHandle zh, int reg_type, } static void add_isam_p(const char *name, const char *info, - struct grep_info *p) + struct grep_info *p) { if (!log_level_set) { @@ -958,6 +958,7 @@ static int string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, use_value = 1016; for (base_no = 0; base_no < num_bases; base_no++) { + int ord = -1; int attr_ok = 0; int regex_range = 0; int init_pos = 0; @@ -976,23 +977,48 @@ static int string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, } if (xpath_use > 0 && use_value == -2) { - use_value = xpath_use; + /* xpath mode and we have a string attribute */ attp.local_attributes = &id_xpath_attr; attp.attset_ordinal = VAL_IDXPATH; id_xpath_attr.next = 0; + + use_value = xpath_use; /* xpath_use as use-attribute now */ id_xpath_attr.local = use_value; } - else if (curAttributeSet == VAL_IDXPATH) + else if (curAttributeSet == VAL_IDXPATH && use_value >= 0) { + /* X-Path attribute, use numeric value directly */ attp.local_attributes = &id_xpath_attr; attp.attset_ordinal = VAL_IDXPATH; id_xpath_attr.next = 0; id_xpath_attr.local = use_value; } - else + else if (use_string && + (ord = zebraExplain_lookup_attr_str(zh->reg->zei, + use_string)) >= 0) + { + /* we have a match for a raw string attribute */ + char ord_buf[32]; + int i, ord_len; + + if (prefix_len) + term_dict[prefix_len++] = '|'; + else + term_dict[prefix_len++] = '('; + + ord_len = key_SU_encode (ord, ord_buf); + for (i = 0; inext) - { - int ord; - char ord_buf[32]; - int i, ord_len; - - ord = zebraExplain_lookupSU (zh->reg->zei, attp.attset_ordinal, - local_attr->local); - if (ord < 0) - continue; - if (prefix_len) - term_dict[prefix_len++] = '|'; - else - term_dict[prefix_len++] = '('; - - ord_len = key_SU_encode (ord, ord_buf); - for (i = 0; inext) + { + char ord_buf[32]; + int i, ord_len; + + ord = zebraExplain_lookup_attr_su(zh->reg->zei, + attp.attset_ordinal, + local_attr->local); + if (ord < 0) + continue; + if (prefix_len) + term_dict[prefix_len++] = '|'; + else + term_dict[prefix_len++] = '('; + + ord_len = key_SU_encode (ord, ord_buf); + for (i = 0; ireg->zei, attp.attset_ordinal, - local_attr->local); + ord = zebraExplain_lookup_attr_su(zh->reg->zei, + attp.attset_ordinal, + local_attr->local); if (ord < 0) continue; if (prefix_len) @@ -1858,7 +1885,7 @@ static RSET xpath_trunc(ZebraHandle zh, NMEM stream, char term_dict[2048]; char ord_buf[32]; int prefix_len = 0; - int ord = zebraExplain_lookupSU (zh->reg->zei, curAttributeSet, use); + int ord = zebraExplain_lookup_attr_su(zh->reg->zei, curAttributeSet, use); int ord_len, i, r, max_pos; int term_type = Z_Term_characterString; const char *flags = "void"; @@ -2499,8 +2526,9 @@ void rpn_scan(ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, { int ord; - ord = zebraExplain_lookupSU (zh->reg->zei, attp.attset_ordinal, - local_attr->local); + ord = zebraExplain_lookup_attr_su(zh->reg->zei, + attp.attset_ordinal, + local_attr->local); if (ord > 0) ords[ord_no++] = ord; }