magma collections - indexing and searching.
Timothy James Ziebart
timothy at churchmilitant.org
Wed Sep 15 18:27:52 UTC 2010
Hi all, I have setup a MagmaCollection with two indexes. I loaded the
initial data and it appeared to be successful. I have the following
search:
getMessagesFor: aModule fieldName: aFieldName
"Retreive message from the database"
|aReader|
aReader := (self root at: #fields)
where:[
:each |
(each fieldName at: aFieldName )
&
(each moduleName at: aModule)].
^aReader asArray.
For the records loaded initially this works fine. However any records I
add in the application do not get retrieved using the above method. But
I can recover the new records searching on the fieldName and moduleName
separately. So the indexes appear to be correct. Any Suggestions? Am
I missing a step? Below I've included more details on the initial
setup. Thanks again for your help.
Tim
Initial Setup:
myCollection := MagmaCollection new.
newIndex := MaSearchStringIndex attribute: #fieldName.
myCollection addIndex: newIndex.
newIndex := MaSearchStringIndex attribute: #moduleName.
myCollection addIndex: newIndex.
I added my records using a do loop:
(fields ) do:[ :each |
myCollection add: each
].
The resulting collection was written to Magma.
LBCRepository commit:[LBCRepository root at: #fields put:
myCollection ].
The addField method in the application is as follows:
LBCRepository class method>> addField: aField
self commit:[(self root at: #fields) add: aField]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/magma/attachments/20100915/ae902c1a/attachment.htm
More information about the Magma
mailing list