[Xapian-discuss] Position of term in Search::Xapian
Yaroslav Polyakov
inetd at ukr.net
Tue Feb 27 09:14:04 GMT 2007
Hello,
I try to get term position in index using xapian perl module:
#!/usr/bin/perl -w
use strict;
use Search::Xapian qw(:standard);
my ($db, $qp, $enq, $doc, $term, $pos, @match);
# open index
$db = Search::Xapian::Database->new('index');
# prepare query parser
$qp = Search::Xapian::QueryParser->new($db);
$qp->set_stemmer(new Search::Xapian::Stem('english'));
$qp->set_stemming_strategy(STEM_ALL);
# get query result
$enq = $db->enquire($qp->parse_query('test'));
@match = $enq->matches(0, 10);
foreach (@match) {
$doc = $_->get_document();
for ($term = $doc->termlist_begin();
$term != $doc->termlist_end();
$term->inc()) {
$pos = $term->positionlist_begin();
print $pos->get_position();
}
}
And got such error:
Can't locate auto/Search/Xapian/PositionIterator/get_positio.al in @INC (@INC
contains: /usr/local/lib/perl5/site_perl/5.8.5/mach /usr/local/lib/perl5/site_perl/5.8.5 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.5/BSDPAN /usr/local/lib/perl5/5.8.5/mach /usr/local/lib/perl5/5.8.5 .)
at ./test line 29
What am I doing wrong? All terms of this document have the position (was added
with add_posting).
I use xapian-core 0.9.9 with Search::Xapian-0.9.9.1
uname -pr
5.5-RELEASE-p8 i386
perl -v
This is perl, v5.8.5 built for i386-freebsd-64int
--
With best regards,
Yaroslav Polyakov
More information about the Xapian-discuss
mailing list