Engines and Schema

Engines are where your content is stored and they have a schema that describes it. When you sign up for Silverstripe Search, engines will be created for you to use. Refer to the Developer’s guide for how to create a schema. Once you are set up you can add your Documents.

Engine

An engine is a group of your documents. All documents within an engine must have the same structure which is known as the engine’s schema. For search to work, your content has to be processed into this searchable structure.

You may have multiple engines either to separate your content (e.g. to have your production site separate from any test sites) or to allow support different schemas.

Limit of 64 fields per schema

An engine has a limit of 64 fields per schema. If you have a large variation of data you may need multiple engines to obtain enough fields.

Schema

Field types are immutable

Once you add a field to an engine you cannot change its name or type without deleting the engine so choose field names and set their types carefully.

Each of your engines has a schema which defines the shape of your data. Schemas consist of schema fields, which tell Silverstripe Search more about what your documents contain so that it can provide matching features.

The schema also defines what kind of data can be stored in specific fields. This is known as the field type (as in “what type of field is it?”, “it's a date field”).

A good example is the use of dates and times. If your schema defines a field as a date field then you will have access to advanced date range filters.

The following data types are supported:

Data Type Description
text Text content. This enables deeply analysed full text search. This is the default type for all new fields. Any group of characters or text that you want to search over should be text. Text can be in many languages.
number

Numbers. Number fields enable fine grained sorting, filtering, faceting, and boosting.

They can either be integers or single-precision, floating-point values (32 bits): 3.14 or 42.

date

Dates. Enables fine grained filtering.

They must be in one of the following formats:

  • Strings containing formatted dates, e.g. "2015-01-01" or "2015/01/01 12:10:30"
  • A number representing seconds-since-the-epoch
geolocation

Location data. Enables location filtering.

Geolocation fields are latitude-longitude pairs, representing locations. The following syntax is supported:

        "location": "41.12,-71.34" // "lat,lon"
        "location": "drm3btev3e86" // geohash
        "location": [ -71.34, 41.12 ] // array with the format [lon, lat]
        "location" : "POINT (-71.34 41.12)" // Geo-point as a "well-known text POINT" https://docs.opengeospatial.org/is/12-063r5/12-063r5.html
    
binary Base64 encoded file content. Only supported for the _attachment field for the purposes of extracting content from files.

Editing and viewing your Schema

You can view your engine's current schema using the Silverstripe Search Administration module or with the API. Schema must be created or updated by an API request. For more information, refer to the Developer’s Guide.