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
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
Seemingly Similar Threads
- uncaught C++ exception from Perl Search::Xapian XS?
- PHP XapianTermIterator/XapianPositionIterator usage
- uncaught C++ exception from Perl Search::Xapian XS?
- Compact databases and removing stale records at the same time
- Given a document, how do you get its ID? (perl bindings)