[Xapian-devel] how to change the default operator?
Shen Li
te_quira at hotmail.com
Thu Mar 24 22:04:26 GMT 2011
Hi Olly,
Thanks very much for your advice! I've managed to explicitly set the default operator each time with php binding instead of changing the Xapian core. However, I'm still wondering that whether it's possible to use multiple operators like a operators chain in queryparser. And if it is, how should I implement that? I really appreciate your help and maybe some reference would be even better!
Best,
Shen
> Date: Thu, 24 Mar 2011 05:01:56 +0000
> From: olly at survex.com
> To: te_quira at hotmail.com
> CC: xapian-devel at lists.xapian.org
> Subject: Re: [Xapian-devel] how to change the default operator?
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20110325/a6537236/attachment.htm>
More information about the Xapian-devel
mailing list