Issue with self defined indexes

Hilaire Fernandes hilaire at ofset.org
Tue Jun 9 09:08:52 UTC 2009


I have an issue with index I defined of my own. It is not working
properly, I don't see why.


I have created a simple index for attributes taking values in a
pre-set list, it looks like:

MaVocabularyIndex>>keySize
        ^ 8

MaVocabularyIndex>>vocabulary: aCollection
	vocabulary := aCollection asOrderedCollection add: 'inconnu'; yourself

MaVocabularyIndex>>indexHashForIndexObject: anObject
       ^ vocabulary indexOf: anObject ifAbsent: [MagmaInvalidIndexObject
signal: 'Unvalid index value']


To use it:

aMagmaCollection addIndex: ((MaVocabularyIndex attribute: #status)
	vocabulary: LomStatus frenchVocabularies);

where LomStatus frenchVocabularies returns #('brouillon' 'final'
'r?vis?' 'indisponible')

Is there anythings wrong in such implementation of an index?

After committing a lot of data I see strange result when doing queries:

(resources where: [:e | e status in: #('final' )]) size -> 146
(resources where: [:e | e status in: #('indisponible' )]) size 0
(resources where: [:e | e status in: #('final' 'indisponible')]) size ->
250

Definitely it is not consistent, any tips where to look at?

Btw, all the indexed attributes accessors (ie #status) return an
OrderedCollection containing one or more terms from the vocabulary
reference lists.


When committing my data, I pay attention to commit only when all
attributes are set. If I add a noteForOldKey in the commit block I get
at some point of the importing data process a MaSoftwareError. The error
is not fixed to a particular imported data, but it looks like from a
certain level of imported data.

Hilaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Ceci est une partie de message
	=?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url : http://lists.squeakfoundation.org/pipermail/magma/attachments/20090609/5a0bfc3b/attachment.pgp


More information about the Magma mailing list