On Thu, Jan 01, 2004 at 11:19:07PM -0500, Eric B.Ridge wrote: > I couldn't think of a way to create a whole new database type for > Xapian that could deal with managing 5 btree indexes inside of Postgres > (other than using tables w/ standard postgres btree index on certain > fields), so instead, I dug into Xapian and abstracted out it's > filesystem i/o (open, read, write, etc). > > (as an aside, I did spend some time pondering ways to adapt Postgres' > nbtree AM to handle this, but I just don't understand how it works)
I think your approach is too ugly. You will have tons of problems the minute you start thinking about concurrency (unless you want to allow only a single user accessing the index) and recovery (unless you want to force users to REINDEX when the system crashes). I think one way of attacking the problem would be using the existing nbtree by allowing it to store the five btrees. First read the README in the nbtree dir, and then poke at the metapage's only structure. You will see that it has a BlockNumber to the root page of the index. Try modifying that to make it have a BlockNumber to every index's root page. You will have to provide ways to access each root page and maybe other nonstandard things (such as telling the root split operation what root page are you going to split), but you will get recovery and concurrency (at least to a point) for free. Hope this helps, -- Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) "La espina, desde que nace, ya pincha" (Proverbio africano) ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]