From: Adam Dickmeiss Date: Mon, 6 Feb 2006 23:16:03 +0000 (+0000) Subject: Fix for bug 431/460 X-Git-Tag: ZEBRA.1.3.34~8 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=851601cad9dab85dea581453e792197bcc0fbb0e;p=idzebra-moved-to-github.git Fix for bug 431/460 --- diff --git a/data1/d1_absyn.c b/data1/d1_absyn.c index c89456a..43291b3 100644 --- a/data1/d1_absyn.c +++ b/data1/d1_absyn.c @@ -1,4 +1,4 @@ -/* $Id: d1_absyn.c,v 1.9.2.5 2005-11-23 14:26:04 adam Exp $ +/* $Id: d1_absyn.c,v 1.9.2.6 2006-02-06 23:16:03 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -297,7 +297,6 @@ static const char * mk_xpath_regexp (data1_handle dh, const char *expr) { const char *p = expr; int abs = 1; - int i; int e = 0; char *stack[32]; char *res_p, *res = 0; @@ -315,7 +314,7 @@ static const char * mk_xpath_regexp (data1_handle dh, const char *expr) { int is_predicate = 0; char *s; - int j; + int i, j; for (i = 0; *p && !strchr("/",*p); i++, p++) ; res_size += (i+3); /* we'll add / between later .. */ @@ -344,8 +343,11 @@ static const char * mk_xpath_regexp (data1_handle dh, const char *expr) } res_p = res = nmem_malloc(data1_nmem_get(dh), res_size + 10); - i = 0; - sprintf(res_p, ".*/"); + *res_p = '\0'; + if (stack[e-1][0] == '@') /* path/@attr spec (leaf is attribute) */ + sprintf(res_p, "/"); + else + sprintf(res_p, "[^@]*/"); /* path .. (index all cdata below it) */ res_p = res_p + strlen(res_p); while (--e >= 0) { sprintf(res_p, "%s/", stack[e]); diff --git a/recctrl/recgrs.c b/recctrl/recgrs.c index d71664a..37c8132 100644 --- a/recctrl/recgrs.c +++ b/recctrl/recgrs.c @@ -1,4 +1,4 @@ -/* $Id: recgrs.c,v 1.86.2.7 2006-02-06 13:34:00 adam Exp $ +/* $Id: recgrs.c,v 1.86.2.8 2006-02-06 23:16:03 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -446,7 +446,9 @@ data1_termlist *xpath_termlist_by_tagpath(char *tagpath, data1_node *n) int ok = 0; sprintf (pexpr, "/%s\n", tagpath); - yaz_log(LOG_DEBUG,"Checking tagpath %s",tagpath); +#if 0 + yaz_log(LOG_DEBUG, "Checking tagpath %s", tagpath); +#endif while (xpe) { int i; @@ -563,7 +565,7 @@ static void index_xpath (data1_node *n, struct recExtractCtrl *p, yaz_log(LOG_DEBUG, "index_xpath level=%d use=%d", level, use); if ((!n->root->u.root.absyn) || (n->root->u.root.absyn->enable_xpath_indexing)) { - termlist_only = 0; + termlist_only = 0; } switch (n->which) @@ -806,9 +808,9 @@ static void index_xpath (data1_node *n, struct recExtractCtrl *p, } else { - /* if this fragment is enabled, we index - attribute values as well. See bug #460 */ - if (0 && xp->value) { + /* index attribute value (only path/@attr) */ + if (xp->value) + { wrd->attrSet = (int) (tl->att->parent->reference); wrd->attrUse = tl->att->locals->local;