Yaroslav Polyakov
2007-Feb-27 09:11 UTC
[Xapian-discuss] Position of term in Search::Xapian
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
On Tue, Feb 27, 2007 at 11:14:04AM +0200, Yaroslav Polyakov wrote:> What am I doing wrong? All terms of this document have the position > (was added with add_posting).The pod documentation is wrong - you need to call get_termpos() not get_position(). I'll correct that. Cheers, Olly
Felix Antonius Wilhelm Ostmann
2007-Feb-27 11:29 UTC
[Xapian-discuss] how does work get_collapse_count?
Is it possible to get the exact count of matches? Currently some projects use another index, and they use the exact count to work with it. what can i do to make this feature working with xapian? -- Mit freundlichen Gr??en Felix Antonius Wilhelm Ostmann -------------------------------------------------- Websuche Search Technology GmbH & Co. KG Martinistra?e 3 - D-49080 Osnabr?ck - Germany Tel.: +49 541 40666-0 - Fax: +49 541 40666-22 Email: info@websuche.de - Website: www.websuche.de -------------------------------------------------- AG Osnabr?ck - HRA 200252 - Ust-Ident: DE814737310 Komplement?rin: Websuche Search Technology Verwaltungs GmbH - AG Osnabr?ck - HRB 200359 Gesch?ftsf?hrer: Diplom Kaufmann Martin Steinkamp --------------------------------------------------