[Xapian-discuss] Queryparser and Boolean

Colin Bell colinabell at gmail.com
Wed Apr 9 18:08:23 BST 2008


Ok, as far this goes. I hang my head in shame....

I had been dropping the query to lowercase ... hence why boolean was  
failing. On the plus side everything works really well now!

My apologies.. I hope someone learns from my mistake! Thanks again for  
your help Olly.

Colin

On 7 Apr 2008, at 15:31, Olly Betts wrote:

> On Mon, Apr 07, 2008 at 02:52:37PM +0100, Colin Bell wrote:
>> qp.set_default_op(Xapian::Query::OP_OR);
>> qp.set_stemmer(Xapian::Stem("english"));
>> qp.set_stemming_strategy(Xapian::QueryParser::STEM_ALL);
>> qp.set_stopper(new MyStopper());
>> qp.set_database(db);
>> Xapian::Query query;
>> query = qp.parse_query(text,
>> Xapian::QueryParser::FLAG_SPELLING_CORRECTION|
>> Xapian::QueryParser::FLAG_BOOLEAN|Xapian::QueryParser::FLAG_PHRASE);
>
> Incidentally, you can refer to the flags via an object of the type, so
> qp.FLAG_BOOLEAN works and is shorter!
>
>> So when I do a search such as "(pension funds) AND (barclays bank)"  
>> or
>> "(pension funds) NOT (barclays bank)" I get the same results.
>>
>> I'm obviously being daft and not doing something right, but I can't
>> see what it is.
>
> It can be helpful to see what the query you get is:
>
>    cout << query.get_description() << endl;
>
> Trying out similar queries, it looks like there's an odd bug here and
> the first term in the first bracket is being eaten by something (but
> I don't get the same query, although perhaps the two queries without
> `a' give you the same results).
>
> Anyway, I'll investigate.
>
> Cheers,
>    Olly




More information about the Xapian-discuss mailing list