Test for the end of PostingIterator in perl?

Alex Aminoff aminoff at nber.org
Tue Jun 6 19:13:04 BST 2017


Hi all. I want to iterate over all the documents in my database.

     my $pi = $db->postlist_begin("");
     while ("$pi" =~ qr/END/) {
         my $oldid = $pi->get_docid;
         $pi++;
	#...
	}

That used to work with Search::Xapian in perl version 1.2, but now with 
xapian-bindings-1.4.4 it does not seem to. How are you supposed to tell 
when you have reached the end of a postlist?

The above code now appears to segfault at get_docid, presumably because 
we went over the end of the list.

Thanks,
  - Alex Aminoff
    NBER



More information about the Xapian-discuss mailing list