Fix problem with generic proximity handling.
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 27 Apr 2009 13:20:51 +0000 (15:20 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 27 Apr 2009 13:20:51 +0000 (15:20 +0200)
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
test/api/test_search.c

index 5d096de..896854e 100644 (file)
@@ -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; i<n; i++)
                 {
                     zint diff = (*kctrl->getseq)(p->buf[1]) - seqno[i];
index 6d568af..b42d5ee 100644 (file)
@@ -49,7 +49,7 @@ const char *myrec[] = {
         "  </Bounding-Coordinates></Spatial-Domain>\n"
         "</gils>\n",
 
-        "<gils>\n<title>My title x</title>\n</gils>\n" ,
+        "<gils>\n<title>My title x</title><abstract>a b c c c a y</abstract>\n</gils>\n" ,
 
         "<test_search>\n"
         " <date>2107-09-19 00:00:00</date>\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));