Description of Methods and Functions

Index Specification Frames

An index specification frame (index spec) is a frame describing a particular index on a soup. Its structure is one of two types:

{structure: 'slot, path: 'pathExpr, type: 'dataType}
{structure: 'multislot, path: ['pathExpr, ...], type: ['dataType, ...]}
Here is a description of each of the slots:

structure
The kind of index. This can be 'slot, for a single-slot index, or 'multislot, for a multi-slot index.

path
The path of the indexed slot. It can be a symbol like 'name or 'date, or a path expression like 'name.first. For a multi-slot index, this is an array of symbols or path expressions.

type
This specifies the type of value contained in the indexed slot. Each entry must contain the same type of value in the indexed slot. For example, if you index on a name slot, you have a string value in this slot. The possible values for type are 'int, 'string, 'char, 'real, or 'symbol. For a multislot index, this is an array of types (which parallels the path array).
This slot can also have the value 'tags, which specifies that the path slot of the entries contains tags. Note that you can have only one tags index per soup.

order
optional. The keys in an index are in ascending order by default ('ascending). Setting the order slot to 'descending, changes the keys to descending order. For a multislot index, this is an array of symbols (which parallels the path array). Each symbol is either 'ascending or 'descending. This allows you to independently set the order of each of the slots.


An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996