magma collections - indexing and searching.
Chris Muller
asqueaker at gmail.com
Sat Sep 18 20:32:21 UTC 2010
Does an OR conditions work?
> aReader := (self root at: #fields)
> where:[
> :each |
> (each fieldName at: aFieldName )
> | <----------------- try OR condition instead *********
> (each moduleName at: aModule)].
On Wed, Sep 15, 2010 at 1:27 PM, Timothy James Ziebart
<timothy at churchmilitant.org> wrote:
> 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]
>
>
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
>
>
More information about the Magma
mailing list