Problem when replacing a collection within a MagmaCollection
Amir Ansari
fractallyte at csi.com
Mon Apr 11 06:59:28 UTC 2011
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
More information about the Magma
mailing list