Structure
This documentation is believed to be up to date for Xapian 1.0.10.
Flint has between 3 and 7 Btree tables each of which holds a sorted collection of key/tag pairs. Keys are unique and of limited length. There is a limit on tag length, but it's very large.
The tables which are always present are postlist, record, and termlist. The optional tables are value, position, spelling, and synonym - these are created only if content is added to them.
The keys for the position, record, termlist, and value tables are carefully chosen to sort such that when adding new documents we're always appending to the end of the table (since appending is a particularly fast operation).
The special key/tag pair which store the total document length and last document id is stored in the postlist table (quartz stored it in the record table). This means that when appending documents, flint will only have one insertion point in the record table (after the last existing key). The postlist table will inevitably require insertions all over the place.
Quartz's locking technique could leave stale write locks behind if an
indexing process didn't exit cleanly. Flint uses an improved locking
technique based on fcntl()
which means the OS automatically releases
the lock for us in this situation.
The Btree tables are implemented by a common base class (FlintTable) which is subclassed as FlintPositionListTable, FlintPostListTable, FlintRecordTable, FlintSpellingTable, FlintSynonymTable, FlintTermListTable, and FlintValueTable.