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
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@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/magma
It looks it is not the end of the story.
Now, when I update an indexed object, particularly updating an attribute indexed with my custom index, I have the following unexpected behaviour:
(BaseLandes resources where: [:e | e status equals: 'indisponible']) size -> 203
BaseLandes resources anyOne status -> an OrderedCollection('final')
BaseLandes commit: [BaseLandes noteOldKeysFor: BaseLandes resources anyOne. BaseLandes resources anyOne pushLifecycleStatus: 'indisponible']
BaseLandes resources anyOne status -> an OrderedCollection('indisponible')
*BUT*, still 203 reference with attribute status to 'indisponible'
(BaseLandes resources where: [:e | e status equals: 'indisponible']) size -> 203
However, the following produces the expected result:
BaseLandes resources count: [:e | e status includesAnyOf: #('indisponible')] -> 204
Any tips about the behaviour of #noteOldKeyFor: ?
But I fell like my index class is the one responsible, however I can't see where it is wrong.
Hilaire
Le mercredi 10 juin 2009 à 16:36 +0200, Hilaire Fernandes a écrit :
Okay, it looks like my index keySize is too small. I got consistant result with a 32 or 16 bits key.
magma@lists.squeakfoundation.org