[Xapian-discuss] [issue] The difference between QueryParser::FLAG_AUTO_SYNONYMS and QueryParser::FLAG_AUTO_MULTIWORD_SYNONYMS

James Aylett james-xapian at tartarus.org
Wed Jan 4 11:32:23 GMT 2012


On 4 Jan 2012, at 09:50, Richard Boulton wrote:

>> 1358     subqs.reserve(terms.size());
>> 1359     if (state->flags & QueryParser::FLAG_AUTO_MULTIWORD_SYNONYMS) {
>> 1360         // Check for multi-word synonyms.
>> 1361         Database db = state->get_database();
> 
> This is a bug, I think.  As you observe, this "if" clause evaluates to
> true if flags is set to FLAG_AUTO_SYNONYMS.  I think this could be
> fixed by changing line 1359 (above) to
> 
> if (state->flags & 1024) {


Eww. I'd say have a separate constant and make FLAG_AUTO_MULTIWORD_SYNONYMS | them together. The alternative is kind of:

#define check_flags(f,m) ((f & m)==m)

but that makes for either long code or semi-impenetrable macros :-(

J

-- 
 James Aylett
 talktorex.co.uk - xapian.org - devfort.com




More information about the Xapian-discuss mailing list