[rucksack-devel] How to use Indexing?

Arthur Lemmens alemmens at xs4all.nl
Thu Nov 16 08:04:27 UTC 2006


[Sorry for the late reply.]

Rüdiger Sonderfeld wrote:

> (with-rucksack (r "/tmp/foosack/")
>    (with-transaction ()
>      (defclass article ()
>        ((title :initarg :title :accessor title
> 	      :index :case-insensitive-string-index))
>        (:metaclass persistent-class)
>        (:index t))
>      (add-rucksack-root (make-instance 'article :title "demo") r)))
>
> Now I want to search for the object by using the value of title as
> the index. Is this possible with rucksack?

Yes, definitely.  At the moment there is no special search function,
but it's easy to define one on top of RUCKSACK-MAP-SLOT.  You should
probably use the :EQUAL keyword argument in this case.  See the
examples in test-index*.lisp and the documentation strings for
RUCKSACK-MAP-SLOT and MAP-INDEX.  Let me know if you need more help.

> btw. Is there any example code or code of projects already using
> rucksack available?

I'm not using Rucksack for my own projects at the moment (too busy
consulting), and I'm aware of at least one bug that needs to be fixed
before I would trust it for real work.

You can see the bug by running BTREE-STRESS-TEST; sooner or later it
will fail with an inconsistent btree.  I think this means that
there's a (very rarely occurring) problem in BTREE-DELETE.

Arthur






More information about the rucksack-devel mailing list