
CHAPTER 11
Data Storage and Retrieval
11-52 Using Newton Data Storage Objects
▲ W ARNING
Index keys are limited to a total of 39 unicode characters (80
bytes, 2 of which are used internally) per soup entry. Keys that
exceed this limit may be truncated when passed to an
indexValidTest function. This 80-byte limit applies to the
entire key space allocated for an entry, not for individual keys. As
a result, subordinate keys in multiple-slot indexes may be
truncated or missing when the total key size for the entry is
greater than 80 bytes. For more information, see the description of
the
indexValidTest function in “Query Specification Frame”
(page 9-9) in Newton Programmer’s Reference. See also the
description of the
MakeKey method (page 9-45) in Newton
Programmer’s Reference.
▲
Limitations of Index Keys 11
Under the following conditions, a string may not match its index key exactly:
■ Keys of type 'string are truncated after 39 unicode characters.
■ Ink data is stripped from 'string keys.
■ Subkeys in multiple-slot indexes may be truncated or missing when the total key
size is greater than 80 bytes.
You can use the
MakeKey function to determine precisely the index key that the
system generates for a particular string. The interface to this function looks like the
following code fragment:
soup:MakeKey(string, indexPath)
The following examples presume that mySoup is a valid soup (not a union soup)
having the multiple-slot index specified by the following code fragment:
myMultiSlotIndexSpec := {structure: ' multislot,
path: ['name.first,
'cardType,
'name.last],
type : ['string, 'int, 'string]};
Each of the soup’s entries has a name slot and a cardType slot. The name slot
holds a frame containing the slots
first and last, which contain string data. The
cardType slot holds integer data.
The first example illustrates the truncation of string keys longer than 39 characters.
Evaluating the following code fragment in the Inspector
Comentários a estes Manuais