Issue with self defined indexes

Hilaire Fernandes hilaire at ofset.org
Wed Jun 10 14:36:04 UTC 2009


Okay, it looks like my index keySize is too small. I got consistant
result with a 32 or 16 bits key.

However, value computed by my #indexHashForIndexObject: range from 1 to
may be a maxmum of 30.

How can 8 bits can't be enought?


When I test a bit the index, it seems to work correctly:

t := LomTopElement new.
t addGeneralType: 'son'
t addGeneralType: 'logiciel'

t type
 -> an OrderedCollection('son' 'logiciel')

((MaVocabularyIndex attribute: #type) vocabulary: LomType
frenchVocabularies) indexHashesFor: t 
 --> an OrderedCollection(11 7)

Hilaire

Le mardi 09 juin 2009 à 11:08 +0200, Hilaire Fernandes a écrit :
> 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
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
-------------- 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/20090610/2e2b0886/attachment.pgp


More information about the Magma mailing list