[Xapian-devel] Bug in TermIterator::skip_to() ?

Olly Betts olly at survex.com
Fri Feb 25 16:34:13 GMT 2005


On Fri, Feb 25, 2005 at 02:40:35PM +0100, Pascal Beis wrote:
> In the attached file this is demonstrated with skip_to("amsterdam"),
> which results in the iterator remaining at the first term ("!!!"). If
> you skip_to("amsterda"), the iterator does move to "amsterdam".
> 
> Any ideas on what is going on?

I've found the problem.  When iterating allterms, quartz mishandles
the case when skip_to finds an exact match by not updating the value
returned by the iterator.  The position is changed, so in this case next
will move you to the term after "amsterdam".

The attached patch should fix your test program.  I'll check it into CVS
once I've written a regression test.  Thanks for reporting this bug!

Cheers,
    Olly
-------------- next part --------------
Index: backends/quartz/quartz_alltermslist.cc
===================================================================
RCS file: /usr/data/cvs/xapian/xapian-core/backends/quartz/quartz_alltermslist.cc,v
retrieving revision 1.20
diff -p -u -r1.20 quartz_alltermslist.cc
--- backends/quartz/quartz_alltermslist.cc	20 Aug 2004 16:38:55 -0000	1.20
+++ backends/quartz/quartz_alltermslist.cc	25 Feb 2005 16:28:40 -0000
@@ -130,8 +130,8 @@ QuartzAllTermsList::skip_to(const string
 	    next();
 	}
     } else {
-	DEBUGLINE(DB, "QuartzAllTermList[" << this << "]::skip_to(): key is " <<
-		  pl_cursor->current_key);
+	Assert(key == pl_cursor->current_key);
+	current_term = tname;
     }
     RETURN(NULL);
 }


More information about the Xapian-devel mailing list