[Xapian-discuss] QueryParser problems? (from Perl?)
Eric Parusel
ericparusel at gmail.com
Sun Jul 22 09:11:17 BST 2007
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