Hi Facundo,
self customers select: [:aCustomer | aCustomer name asUppercase beginsWith: firstsLetterOfName asUppercase]
It works ok and with good perfomance but "customers" is a magma collection
Please do not do this. Linear enumeration of an entire large MagmaCollection is something that never performs well.
so I would like use where: because the collection has a index on #name attribute.
self customers where: [:each | aCustomer name = firstsLetterOfName asUppercase]
It works but I had two problems, the first one is that the meaningfulCharacters of MaSearchStringIndex is 5 and then it works if I write exactly the 5 firsts letter of the name.
When you use where: you will get back a MagmaCollectionReader. The reader can be thought of as a "collection" with the items narrowed down to the first-five matching characters. Sending #select: to that reader will only enumerate those items, which are much fewer than the entire collection.
I prefer to favor small key-sizes on my own MagmaCollections; usually 32 bits and less is "blazing" compared to 64, 128 and larger. I think Magma deserves criticism for letting users use larger than 256-bit, because there is too much LI arithmetic-processing to achieve very good performance at those larger sizes..
You may want to consider an index that allows a precise, unique-identification of each customer. You have 20K customers, you could get away with a 16-bit index! While, at the same time solving the issue of two customers with potentially the same name. A system-generated account #..?
- Chris
The second problem is that I can't send asUppercase beacuse name is a MaClause.
The answer to this is here:
http://wiki.squeak.org/squeak/5859
So, my question is: Can I use where: for this funcionality or I need use select:? If you think that where: is appropiate, Do I need create a new king of index to reach that? Thank you, Facu p.s.: I'm using the first code in the method of customersOfNameBeginsWith: selector and i used it on a autocompletation jquery input control. _______________________________________________ Magma mailing list Magma@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/magma