[Q] Any simple magma example for text/tags combination?

Sungjin Chun chunsj at gmail.com
Tue Jan 19 02:01:30 UTC 2010


Thank you for your kind reply.

Does this code scale well to tons of items, eg., 100,000? it seems
that it has to enumerate all the items to find with the specificied
tag.

Are there any index like facility in magma for this?

Thank you again.

2010/1/19 Miguel Enrique Cobá Martinez <miguel.coba at gmail.com>:
> El lun, 18-01-2010 a las 17:19 +0900, Sungjin Chun escribió:
>> Hi,
>>
>> I'd like to test magma with following data;
>>
>> 1. it contains text (string) as main data
>> 2. it contains title (string)
>> 3. it contains tags (a tag is string)
>>
>> I like to acess/order the data by title and want to access data by
>> specifying a tag.
>
> Very easy, make a class, with three inst vars: title, text, tags.
> Store the title, the text and your required tags in them. Tags can be a
> comma-separated string or a collection of strings, each representing a
> tag. As you wish.
>
> Then in other class, maybe called Storage, or DB or whatever add two
> inst vars: items, tags. items will hold objects of the previous class,
> is your list of objects.
> The tags can be:
>
> - just a list of tags, that enumerates all the tags existing in your app
> and that can be used to form a tag-cloud and then the selected tag
> searched. Really "collect:"-ed form the items list:
>  items collect: [ :each | each tags includes: 'your-tag']
>
> - a dictionary of lists where the key is  the tag and the value is a
> list of elements of items that have the tag used as key:
>
>  'tag1' -> an OrderedCollection( item1, item15)
>  'tag2' -> an OrderedCollection( item5, item15)
>
> supposing that item1 has tag1 and item15 has tags: tag1 and tag2.
>
> Of course your code must be handling the adding and removing of tags and
> updating the appropriate elements in order to be consistent.
>
>
> Or some variation of that.
>
> Of course this works with or without magma, as magma is only a storage
> of object and supports cyclic references as this solutions uses.
>
> Cheers
>
>
>>
>> Sorry for poor description and thanks in advance.
>> _______________________________________________
>> Magma mailing list
>> Magma at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/magma
>
> --
> Miguel Cobá
> http://miguel.leugim.com.mx
>
>
>


More information about the Magma mailing list