[Xapian-devel] Re: FLAG_BOOLEAN_ANY_CASE does not work

Sungsoo Kim xingshou at gmail.com
Tue Mar 7 14:15:46 GMT 2006


> As you say, it ought to be using lcterm (at least if we want 'woman And
> man' to work.  But I can't see why your example ('woman and man')
> doesn't already work since we check '(term == "and")'.

Yes, you are right. I missed the fact that "and" was already
lowercase. So it does not need to be converted to lowercase when I
search by "woman and man".


> How are you setting FLAG_BOOLEAN_ANY_CASE?

I have set the flag as shown below.

 query = qp.parse_query(input,
        xapian.QueryParser.FLAG_BOOLEAN |
        xapian.QueryParser.FLAG_BOOLEAN_ANY_CASE |
        xapian.QueryParser.FLAG_PHRASE |
        xapian.QueryParser.FLAG_LOVEHATE |
        xapian.QueryParser.FLAG_WILDCARD)


I've figured out why QP does not accept "and" as operator.
It is resulted from xapian-qp-utf8-0.9.2.patch.
U_isupper(term[0]) should be changed back before the patch.


original xapian-0.9.4

                if (prefix.empty() && !term.empty() && C_isalpha(term[0])) {
                    if (C_isupper(term[0])) {
                        ...
                    } else if (flags & FLAG_BOOLEAN_ANY_CASE) {
                        ...
                    }
                }

after xapian-qp-utf8-0.9.2.patch

                if (prefix.empty() && !term.empty() && U_isupper(term[0])) {
                    if (C_isupper(term[0])) {
                        ...
                    } else if (flags & FLAG_BOOLEAN_ANY_CASE) {
                        ...
                    }
                }


For better Xapian,

Sungsoo Kim






More information about the Xapian-devel mailing list