[Xapian-discuss] Perl XS bindings, postlist_begin

Olly Betts olly@survex.com
Fri, 28 May 2004 14:32:18 +0100

On Fri, May 28, 2004 at 09:26:57AM +0100, Francis Irving wrote:
> To add to this, the problem seems to be casting to a Database.  The
> function doesn't appear in WritableDatabase.

Aha!  We'll need to wrap them in both places I think.  I'll whip up the
obvious patch shortly...

> I can't work out how to cast them, so for now I'm opening a second
> handle.

The flaw with doing that is that you'll not notice an update which
happens in the same unflushed batch as the original addition.  That may
not be a problem for you - in some setups that just doesn't happen.

I've actually been wondering if it's worth pushing this "uid checking"
functionality down into the library.  So you could do something like:

$db->add_or_replace_document($doc, $unique_term);

And if $unique_term existed this would replace the document it indexed, or
add the document otherwise.  This is neater for the library user, and
might be slightly more efficient internally.

Anyway, back to your problem:

> Unfortunately when I try to compare the two values:
>     while ($post != $postend)
>     {
>         print "p is $post\n";
>         $post++;
>     }

Shouldn't you use "ne" to compare here?  In Perl, != is for comparing