[Xapian-discuss] trailing signed char in QueryParser

Olly Betts olly at survex.com
Mon Mar 6 18:42:29 GMT 2006


On Tue, Mar 07, 2006 at 02:58:47AM +0900, Sungsoo Kim wrote:
> Why QP does not convert the term to lowercase before it 
> calls db.term_exists() to look up term list?

That's a bug, thanks for noticing.  The attached patch should fix it.

Cheers,
    Olly
-------------- next part --------------
Index: queryparser/queryparser.lemony
===================================================================
--- queryparser/queryparser.lemony	(revision 6534)
+++ queryparser/queryparser.lemony	(working copy)
@@ -376,7 +376,15 @@
 		    // non-suffixed term does.  This also takes care of
 		    // the case when QueryParser::set_database() hasn't
 		    // been called.
-		    if (db.term_exists(suff_term) || !db.term_exists(term)) {
+		    bool use_suff_term = false;
+		    string lc = downcase_term(suff_term);
+		    if (db.term_exists(lc)) {
+			use_suff_term = true;
+		    } else {
+			lc = downcase_term(term);
+			if (!db.term_exists(lc)) use_suff_term = true;
+		    }
+		    if (use_suff_term) {
 			term = suff_term;
 			it = p;
 		    }


More information about the Xapian-discuss mailing list