Test for the end of PostingIterator in perl?
QE :: Felix Ostmann
ostmann at qe.de
Wed Jun 7 08:12:54 BST 2017
2017-06-06 20:13 GMT+02:00 Alex Aminoff <aminoff at nber.org>:
>
> 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++;
> #...
> }
>
There is also a postlist_end()
while ($pi != $db->postlist_end("")) {
should do the trick (not tested)
>
> 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
>
>
have a nice day
Felix
More information about the Xapian-discuss
mailing list