[rucksack-devel] Re: [rucksack-cvs] removing class instances from index

Arthur Lemmens alemmens at xs4all.nl
Thu Oct 19 11:01:45 UTC 2006


[Moving this from the rucksack-cvs list to rucksack-devel]

Vikram Bhandoh wrote:

> how do I delete an instance from rucksack so that when I run
> rucksack-map-slot I don't see that specific instance again?

There is not one single function to delete an instance from a
rucksack (just like there is no such function in 'normal' Lisp).
So if you want to be sure that you'll never 'see a specific
instance again', you must make sure that there no other persistent
references to that instance.

If the only persistent references to an instance are via Rucksack's
slot or class indexes, deleting the object from those indexes should
do what you want.

> (defclass employee ()
> 	((person :initarg :index-on :reader person
> 			:index :case-insensitive-string-index)
> 	 (history :initarg :history :accessor history)
> 	 (salary :initarg :object-pos :accessor object-pos :index :number-index)
> 	 (job :initarg :job :accessor job :index :symbol-index))
> 	(:metaclass persistent-class)
> 	(:index t))

It looks like you have one class index (because of (:INDEX T)) and three
slot indexes (for PERSON, SALARY and JOB) here, right?  If you want to
get rid of an employee instance you'll have to remove it from all four
indexes.

(Maybe it would be a good idea to add some function to Rucksack to
automatically remove an instance from all indexes.  But at the moment
you'll have to do this by hand.)

> Any help will be greatly appreciated.

Did this help?

Arthur




More information about the rucksack-devel mailing list