[Xapian-discuss] Re: QueryParser problems? (from Perl?)

Eric Parusel ericparusel at gmail.com
Tue Jul 24 16:21:59 BST 2007


Hello,

Should I be putting this in a bug report?
Is this something that others can replicate?

Thanks,
Eric


On 7/22/07, Eric Parusel <ericparusel at gmail.com> wrote:
> I'm currently on 1.0.2 and the matching Search::Xapian perl modules.
>
> I input the following and the queryparser somehow doesn't seem to be
> detecting the operators?
> Am I missing something?
>
> Thanks,
> Eric
>
>
>
> INPUT: a word OR two NEAR "a phrase" NOT (too difficult) +eh
>
> PARSED: Xapian::Query((Za:(pos=1) AND Zword:(pos=2) AND or:(pos=3) AND
> Ztwo:(pos=4) AND near:(pos=5) AND Za:(pos=6) AND phrase:(pos=7) AND
> not:(pos=8) AND Ztoo:(pos=9) AND Zdifficult:(pos=10) AND
> Zeh:(pos=11)))
>
>
> #!/usr/bin/perl
> use Search::Xapian qw(:standard);
>
> my $dbpath = '/path/to/db';
> my $query = 'a word OR two NEAR "a phrase" NOT (too difficult) +eh';
> print "INPUT: $query\n\n";
>
> my $db = Search::Xapian::Database->new($dbpath) || die "Could not open";
>
> my $stemmer = Search::Xapian::Stem->new('english');
>
> my $qp = new Search::Xapian::QueryParser( $db );
> $qp->set_stemmer($stemmer);
> $qp->set_default_op(OP_AND);
> $qp->set_stemming_strategy(STEM_SOME);
>
> my $q = $qp->parse_query($query);
> print "PARSED: " . $q->get_description . "\n";
>



More information about the Xapian-discuss mailing list