[Xapian-devel] how to change the default operator?

Olly Betts olly at survex.com
Thu Mar 24 05:01:56 GMT 2011


On Thu, Mar 24, 2011 at 05:42:52AM +0800, Shen Li wrote:
> I'm sorry to bother you guys with such a rookie question. I tried to
> change the default boolean operator by editing the file queryparser.h
> like this:
> 
> void set_default_op(Query::op OP_AND);

That's not valid C++ syntax, but I guess you meant this?

  void set_default_op(Query::op op = OP_AND);

That would just mean you could call set_default_op() without an
argument like this:

  Xapian::QueryParser qp;
  qp.set_default_op();

I'm assuming you want to make the default OP_AND if set_default_op() is
never called.

That default is set in queryparser/queryparser_internal.h, line 87 in
current trunk.

But it's not really a good idea to change this - it means your code will
only work as intended with a modified version of Xapian.  It's better
just to explicitly set the default operator each time.

Cheers,
    Olly



More information about the Xapian-devel mailing list