[Glass] Indexing question
Martin McClure
martin.mcclure at gemtalksystems.com
Mon Dec 9 17:56:13 PST 2013
On 12/09/2013 05:31 PM, BrunoBB wrote:
> These instance are already in different collection. A FormDefinition hold
> the instances (FormInstance) of a particular subset of keys. For each type
> of form you have an instance of FormDefinition then the actual instances of
> the form (FormInstance) are hold by it's form definition.
>
> The question is how to add an index to these subset. Index by the key of the
> dictionary.
Hi Bruno,
OK, I'm getting a clearer image. :-)
So you have a FormDefinition, which contains a collection of
FormInstances, each of which should have known fields in its <fields>
instvar. And you want to query by the values of one (or more) of those
fields.
I don't think it's possible to do that directly with traditional
GemStone indexing, though we've talked about adding this kind of
capability, and there will be some new abilities in 3.2. But there are
indirect ways of doing this, by making the FormDefinition do some of the
indexing work.
There are a number of ways to do this. Examples: If you don't need
inequality comparisons in queries ('form_number' < 9999), only equality
('form_number' = 4321), you could store the FormInstances as values in a
KeyValueDictionary whose key is the field being indexed. If you do need
inequality comparisons, you could add an <indexValue> instvar to
FormInstance and have the FormDefinition set that instvar from the
fields as the FormInstance is being added to the FormDefinition's
collection. That collection would be indexed on the <indexValue> instvar.
Regards,
-Martin
More information about the Glass
mailing list