[Xapian-discuss] Perl XS bindings, postlist_begin
Francis Irving
francis@flourish.org
Fri, 28 May 2004 09:26:57 +0100
On Fri, May 28, 2004 at 08:37:48AM +0100, Francis Irving wrote:
> On Fri, May 28, 2004 at 01:20:31AM +0100, Olly Betts wrote:
> > But it looks like postlist_begin() isn't wrapped yet. Since
> > PostingIterator is now wrapped (as of 0.8.0.2) that's easy - patch
> > attached. I've not tested this beyond it compiling, but it's pretty
> > trivial (famous last words...)
>
> Fab. The patch applies, gives fewer warnings, and installs... But I
> still can't call the function on a Database.
>
> my $db=Search::Xapian::WritableDatabase->new($dbfile, Search::Xapian::DB_CREATE_OR_OPEN);
> my $post = $db->postlist_begin("ethiopia");
>
> Can't locate auto/Search/Xapian/WritableDatabase/postlist_be.al in
> @INC
To add to this, the problem seems to be casting to a Database. The
function doesn't appear in WritableDatabase. I can't work out how
to cast them, so for now I'm opening a second handle. And this runs
OK:
my $dbr=Search::Xapian::Database->new($dbfile);
my $post = $dbr->postlist_begin("ethiopia");
my $postend = $dbr->postlist_end("ethiopia");
Unfortunately when I try to compare the two values:
while ($post != $postend)
{
print "p is $post\n";
$post++;
}
I get a "14061 Segmentation fault". This happens in the !=
operator, and only when comparing to $postend. This line
runs fine, comparing it to itself as a test:
while ($post != $post)
Francis