[Xapian-devel] when file for test is added into database

Olly Betts olly at survex.com
Sun Jun 8 01:29:15 BST 2014

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.


More information about the Xapian-devel mailing list