This section show how to create index for fast search.

Each Form Definition has a list of fields. In Orbeon a field can be a search field or not. Indexes can only be created in search fields.

In order to create indexes a database user has to login to GemStone/S using Jade or Topaz client. To create indexes there are several rules to comply:

1) If there is an attempt to create an index on a field that is not a search field then the script will answer a proper exception. In this case "IsNotSearchFieldException".

2) Indexes are an optimization and it worth it if there are more than 2000 elements in the fields collection. For that particular Form Definition must be at least 2000 Form Instances in order to create an index on any search field. An attempt by a script to create an index in a collection with less than 2000 elements will raise a proper exception. In this case "CollectionWithout2000ElementsException".

Example: Once logged into GemStone/S execute the following code: Create an index on field named 'amount' in Form Definition named "income_taxes" of application "all_taxes" for version 3:

| publishedForms |
publishedForms :=
getAllPublishedDefinitionNamed: 'income_taxes'
fromApplicationNamed: 'all_taxes'
withVersion: 3
ifNone: [OrderedCollection new].
publishedForms do: [:each | each createIndexForFieldNamed: 'amount'].
System commit.