[Seaside] Re: Seaside and GOODS
Daniel Salama
dsalama at user.net
Fri Mar 18 23:43:42 CET 2005
On Mar 18, 2005, at 6:58 AM, Avi Bryant wrote:
>
>> Then again, how do you create indices? Is this something GOODS
>> related?
>> I couldn't find documentation about it. I must be missing something
>> because others I've talked to about GOODS have mentioned it to me as
>> well.
>
> By "index" I just mean "some keyed collection you're using to index a
> property of your objects". A BTree would be a common class to use as
> an index.
>
Ok, hopefully second to last question :)
So you are suggesting that I can maintain something like separate
BTrees for different indices I may need for traversing my actual
objects. So, what's stored in the BTree? Let's say I have something
like:
db := KKDatabase onHost: 'localhost' port: 6000.
db root: Dictionary new.
db commit.
people := BTree new.
lastNameIndex := BTree new.
db root at: 'people' put: people.
db root at: 'lastNames' put: lastNameIndex.
person := Person new; firstName: 'Daniel'; lastName: 'Salama'.
people at: 'some_magical_key_like_an_oid' put: person.
lastNameIndex at: (person lastName) put: person.
db commit.
Basically, I create one person object and store it twice in the
database. However, from your previous answers, only one instance of the
object is actually stored. The other one is simply a reference.
Are my assumptions correct? Is what I did correct?
What would happen if I needed to sort the people by last name or maybe
first name or some random pre-defined property? Should I implement
multiple indices based on the potential different properties I'd like
to sort by? Should these indices be something like SortedCollection or
a BTree or something else from your BTree package?
Thanks again,
Daniel Salama
More information about the Seaside
mailing list