Apple Newton Utilities Guide de l'utilisateur Page 476

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 942
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 475
CHAPTER 11
Data Storage and Retrieval
11-44 Using Newton Data Storage Objects
This query nds entries containing the words "Bob", "Bobby", and so forth, but
not words such as
"JoeBob". Text queries are not case sensitive—even though the
original query spec is all lower case, this query nds entries such as
"Bob" or "BOB".
Because the
words slot contains an array, it can be used to search for multiple
string beginnings. For example, the following code fragment returns entries that
contain both of the string beginnings
"Bob" and "Apple". Thus, an entry
containing the strings
"Bobby" and "Applegate" would be included in the
results of the search, but an entry missing either of the word beginnings
"Bob" or
"Apple" is not included.
// find entries holding "bob" and "apple" word beginnings
// won’t find entries having only one of these beginnings
local myCurs := mySoup:Query({words: ["bob", "apple"]});
Because each element in the array is a string, each “word” to be matched can
actually contain multiple words and punctuation. For example, the following code
fragment returns entries that contain both of the string beginnings
"Bob" and
"Apple Computer, Inc.":
// find word beginnings "bob" and "Apple Computer, Inc."
local myCursor := mySoup:Query({words: ["bob",
"Apple Computer, Inc."]});
Note
The more unique the search string is, the more quickly a words
search proceeds. Thus,
words queries are slow for search words
that have only one or two characters in them.
To search for entire strings, rather than string beginnings, the query spec must
include an
entireWords slot that holds the value true, as shown in the
following code fragment:
// return entries holding entire words "bob" and "Apple Computer"
local myCursor := mySoup:Query({words: ["bob", "Apple Computer"],
entireWords: true });
This query returns entries that contain both of the strings "Bob" and "Apple
Computer". Because the entireWords slot holds the value true, this query
does not match strings such as
"Apple Computer, Inc." or "Bobby".
Entries containing only one of the specied words are not included in the results of
the search.
To conduct a text search that is not constrained by word boundaries, add to your
query spec a
text slot containing a single string to be matched. For example, the
Vue de la page 475
1 2 ... 471 472 473 474 475 476 477 478 479 480 481 ... 941 942

Commentaires sur ces manuels

Pas de commentaire