From: Adam Dickmeiss Date: Thu, 23 Oct 2008 09:35:09 +0000 (+0200) Subject: Align sequence numbers for words in z:index sections for mod_dom. X-Git-Tag: v2.0.34~11 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=4f0ac986e5526dfaf91564f7e7d03b915afe8f07 Align sequence numbers for words in z:index sections for mod_dom. --- diff --git a/index/mod_dom.c b/index/mod_dom.c index ad97171..7ade71d 100644 --- a/index/mod_dom.c +++ b/index/mod_dom.c @@ -813,10 +813,18 @@ static void index_value_of(struct filter_info *tinfo, { xmlChar *text = xmlNodeGetContent(node); size_t text_len = strlen((const char *)text); - + /* if there is no text, we do not need to proceed */ if (text_len) { + /* keep seqno base so that all text will have + identical seqno's for multiple fields , e.g + .. */ + + zint seqno_base = recword->seqno; + zint seqno_max = recword->seqno; + + const char *look = index_p; const char *bval; const char *eval; @@ -864,6 +872,7 @@ static void index_value_of(struct filter_info *tinfo, /* actually indexing the text given */ + recword->seqno = seqno_base; recword->index_name = (const char *)index; if (*type) recword->index_type = (const char *) type; @@ -878,12 +887,16 @@ static void index_value_of(struct filter_info *tinfo, (extctr->tokenAdd)(recword); + if (seqno_max < recword->seqno) + seqno_max = recword->seqno; + /* eat whitespaces */ if (*look && ' ' == *look) { look++; } } + recword->seqno = seqno_max; } xmlFree(text); } diff --git a/test/xslt/dctoindex.xsl b/test/xslt/dctoindex.xsl index 106c947..407397e 100644 --- a/test/xslt/dctoindex.xsl +++ b/test/xslt/dctoindex.xsl @@ -23,9 +23,7 @@ - - @@ -38,7 +36,7 @@ - + diff --git a/test/xslt/dom1.c b/test/xslt/dom1.c index 957b83a..e22dbfd 100644 --- a/test/xslt/dom1.c +++ b/test/xslt/dom1.c @@ -126,14 +126,17 @@ void tst(int argc, char **argv) YAZ_CHECK(tl_query(zh, "@attr 1=title b", 1)); zh = index_some(zs, "dom.gutenberg.xml", "gutenberg-sample.xml"); - YAZ_CHECK(tl_query(zh, "selected", 1)); + YAZ_CHECK(tl_query(zh, "oscar", 1)); YAZ_CHECK_EQ(tl_fetch_first_compare( zh, "zebra::snippet", yaz_oid_recsyn_xml, "\n" - " etext/1338\n" - " Project Gutenberg\n" - " Selected Prose of Oscar Wilde\n" + " " + "Selected Prose of Oscar Wilde" + "\n" + " " + "Wilde, Oscar, 1854-1900" + "\n" ""), ZEBRA_OK);