[Xapian-discuss] Perl bindings: QueryParser::OP_AND

John Wang johncwang at gmail.com
Fri Jul 14 19:53:58 BST 2006


On 7/14/06, Olly Betts <olly at survex.com> wrote:
>
> On Fri, Jul 14, 2006 at 11:00:39AM -0700, John Wang wrote:
> > When I set the query parser default op to OP_AND like the following:
> >
> >  $qp->set_default_op('Search::Xapian::QueryParser::OP_AND')
> >
> > I get an error in the Apache log:
> >
> >  Argument "Search::Xapian::QueryParser::OP_AND" isn't numeric in
> subroutine
> > entry
> >
> > but it does what it's supposed to. Is this error something to worry
> about?
>
> I don't think you want the single quotes - it only works because Perl
> interprets a non-numeric value as 0 and OP_AND happens to be 0
> internally.


Thanks Olly,

When I remove the quotes I get the following fatal error when running Perl's
(often recommended) strict pragma:

  [error] Bareword "Search::Xapian::QueryParser::OP_AND" not allowed while
"strict subs" in use

Just setting it to zero works though I'm not sure if that's by coincidence.

  $qp->set_default_op( 0 );

Search::Xapian mentions:

OP_AND
OP_OR
OP_AND_NOT
OP_XOR
OP_AND_MAYBE
OP_FILTER
OP_NEAR
OP_PHRASE
OP_ELITE_SET

In what file can I get the numeric value for each of these and will setting
set_default_op to a number work?

Thanks.

-- 
John Wang
http://www.dev411.com/blog/


More information about the Xapian-discuss mailing list