Problem when replacing a collection within a MagmaCollection

Chris Muller asqueaker at gmail.com
Tue Apr 12 16:38:42 UTC 2011


Please see:

  http://wiki.squeak.org/squeak/2639

Your answer is at the bottom of that page.


On Mon, Apr 11, 2011 at 1:59 AM, Amir Ansari <fractallyte at csi.com> wrote:
> Hi List
>
> Sorry for this long post, but I'm having a problem and just can't figure out where I'm going wrong...
>
> I created a new class, 'FruitBowl', with variables 'color' and 'fruits', and added an instance of it to a database.
>
>        MyDB commit: [
>                MyDB root at: 'fruitbowls' put: (MagmaCollection new
>                        addIndex: (MaSearchStringIndex attribute: #color);
>                        addIndex: (MaKeywordIndex attribute: #fruits);
>                        yourself) ].
>
>        fruitbowls := MyDB root at: 'fruitbowls'.
>        myBowl := FruitBowl new color: 'silver'; fruits: #('apple' 'pear' 'plum'); yourself.
>
>        MyDB commit: [ fruitbowls add: myBowl ].
>        MyDB release.
>
>
> I can query the database without any problem:
>        query := fruitbowls where: [ :each | each fruits includesAllOf: 'pear' subStrings ].
>
>
> However, if I replace the collection of fruits and commit:
>        MyDB commit: [
>                myBowl fruits: #('walnut' 'hazelnut' 'chestnut') ].
>        MyDB release.
>
>
> The new collection seems to be there:
>        reader := fruitbowls read: #color.
>        (reader at: 1) fruits
>
>
> But I can no longer query:
>        query := fruitbowls where: [ :each | each fruits includesAllOf: 'walnut' subStrings ].
>        query size
>
>
> I must be doing something fundamentally silly - can anyone point out what it is?
>
> Thanks!
>
> Amir
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
>


More information about the Magma mailing list