Hurricane Tong
2014-Jun-07 16:54 UTC
[Xapian-devel] when file for test is added into database
Hi, For example, in api_anydb.cc, line 1955, DEFINE_TESTCASE(getdoc1, backend) { Xapian::Database db(get_database("apitest_onedoc")); Xapian::Document doc(db.get_document(1)); get_database seems only to open the database or create it, but not add a doc to it. So I get an exception in db.get_document(1), DocNotFoundError: Document 1 not found. When is concerning docs added? ------------------ Shangtong Zhang,Second Year Undergraduate, School of Computer Science, Fudan University, China. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20140608/72544cc9/attachment.html>
On Sun, Jun 08, 2014 at 12:54:52AM +0800, Hurricane Tong wrote:> For example, in api_anydb.cc, line 1955, > > DEFINE_TESTCASE(getdoc1, backend) { > Xapian::Database db(get_database("apitest_onedoc")); > Xapian::Document doc(db.get_document(1)); > > get_database seems only to open the database or create it, but not add > a doc to it.If you pass a string to get_database(), as is done here, the test harness will index each paragraph of the corresponding file in tests/testdata/ as a document.> So I get an exception in db.get_document(1), > > DocNotFoundError: Document 1 not found.This testcase passes before your changes, so the failure is due to something you've changed. There's probably a bug in your new document length handling - it sounds like there's no document length reported for document 1. Cheers, Olly