On Mon, Oct 03, 2011 at 12:56:31PM +0700, Henrik Sarvell wrote:
> Seems like I need to pass some arguments, rebuild (X Var Cls Hook)
> Can you give me an example, what could X and Var be, Cls is probably
> something like '+Class
Yes. 'rebuild' needs to know _which_ objects in the DB should be put
into the index. For that, you have several options:
1. Supply a list of objects in the first argument ('X'). This makes
sense if the number of involved objects is not too big (a few
million perhaps). You must somehow obtain the list of objects. If
such a list is not known, it is typically built from some other
(rebuild (collect 'foo '+Cls) 'bar '+Cls)
2. Pass the number of the DB file. In that case, 'rebuild' will go
through that file, and put all objects of type '+Cls' it finds
into the index. This is the easiest way, and also not limited by
any memory constraints like (1). But you don't have control about
which objects are put into the index, they'll be all used:
(rebuild 7 'bar '+Cls)
Here, '7' is assumed to be the DB file. You do normally obtain it
(rebuild (db: +Cls) 'bar '+Cls)
3. If 'X' is NIL, 'rebuild' tries to do the 'collect' by itself. This
makes only sense for a non-damanged index, and is used when e.g.
the DB model of that index changed.
> but what is Hook?
'Hook' is another object, being the base of an object-local index. If
you haven't heard of it, you probably haven't used it ;-) See the
reference of '+Hook'.