From: Adam Dickmeiss Date: Mon, 6 Feb 2006 23:22:28 +0000 (+0000) Subject: Fix for bug 460 X-Git-Tag: before.bug.529~257 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=9be04e6cf1e848fcc4f065a7407e489684aaaf61;p=idzebra-moved-to-github.git Fix for bug 460 --- diff --git a/data1/d1_absyn.c b/data1/d1_absyn.c index 34c4dd1..dfe0484 100644 --- a/data1/d1_absyn.c +++ b/data1/d1_absyn.c @@ -1,4 +1,4 @@ -/* $Id: d1_absyn.c,v 1.21 2005-06-29 16:52:26 adam Exp $ +/* $Id: d1_absyn.c,v 1.22 2006-02-06 23:22:28 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -461,7 +461,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 .. */ @@ -490,8 +490,10 @@ 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, ".*/"); + 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 274c130..df538ce 100644 --- a/recctrl/recgrs.c +++ b/recctrl/recgrs.c @@ -1,4 +1,4 @@ -/* $Id: recgrs.c,v 1.106 2006-02-06 13:34:13 adam Exp $ +/* $Id: recgrs.c,v 1.107 2006-02-06 23:22:29 adam Exp $ Copyright (C) 1995-2005 Index Data ApS @@ -813,9 +813,8 @@ static void index_xpath(struct source_parser *sp, data1_node *n, p, wrd); xpdone = 1; } 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) { #if NATTR wrd->index_name = tl->index_name;