From 3fdd3e7aa5372e1a2a981a5826273f381f74be8e Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 27 Apr 2009 15:20:51 +0200 Subject: [PATCH] Fix problem with generic proximity handling. The generic proximity handling did not collect seqnos for first operand correctly. New test case for it in test_search. Fix problem with generic proximity handling. --- rset/rsprox.c | 9 ++++++--- test/api/test_search.c | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rset/rsprox.c b/rset/rsprox.c index 5d096de..896854e 100644 --- a/rset/rsprox.c +++ b/rset/rsprox.c @@ -221,11 +221,14 @@ static int r_forward(RSFD rfd, void *buf, TERMID *term, const void *untilbuf) seqno[n++] = (*kctrl->getseq)(p->buf[0]); while ((p->more[0] = rset_read (p->rfd[0], - p->buf[0], &p->terms[0])) >= -1 && - p->more[0] <= -1) + p->buf[0], &p->terms[0]))) + { + cmp = (*kctrl->cmp)(p->buf[0], p->buf[1]); + if (cmp <= - rfd->rset->scope || cmp >= rfd->rset->scope) + break; if (n < 500) seqno[n++] = (*kctrl->getseq)(p->buf[0]); - + } for (i = 0; igetseq)(p->buf[1]) - seqno[i]; diff --git a/test/api/test_search.c b/test/api/test_search.c index 6d568af..b42d5ee 100644 --- a/test/api/test_search.c +++ b/test/api/test_search.c @@ -49,7 +49,7 @@ const char *myrec[] = { " \n" "\n", - "\nMy title x\n\n" , + "\nMy title xa b c c c a y\n\n" , "\n" " 2107-09-19 00:00:00\n" @@ -239,6 +239,9 @@ static void tst(int argc, char **argv) /* exl=1 distance=2 order=0 relation=3 (=), known, unit=word */ YAZ_CHECK(tl_query(zh, "@attr 1=4 @prox 1 2 1 3 k 2 my x", 1)); + + /* exl=0 distance=2 order=1 relation=2 (<=), known, unit=word */ + YAZ_CHECK(tl_query(zh, "@attr 1=1016 @prox 0 2 1 2 k 2 a y", 1)); /* Non-indexed numeric use, but specified in bib1.att (bug #1142) */ YAZ_CHECK(tl_query_x(zh, "@attr 1=1000 x", 0, 114)); -- 1.7.10.4