HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In

Full-text search support

Describes opt-in for content properties, when using the GraphQL API for the Optimizely querying service, to retrieve content in Optimizely solutions.

The use-case for full-text search is to match on words or phrases in longer textual content (like a description), where as you can use filter on shorter values (like a page title or a name).

Properties on content types are opt-in for full-text search support. By default, fields are filtered only as an exact value. When fields need to have full-text search support, including tokenization and language stemming, the contains operator should be used.

The contains matches on terms which are tokenized by word boundaries according to UAX #29: Unicode Text Segmentation. This means that when you match a term with a leading or trailing punctuation character in a term, these characters are ignored.

Enable full-text search support for fields

You can enable full-text search support from the Optimizely Content Management System (CMS) Admin view by selecting the Searchable property option as shown in the image. This option is available for each property on the content type.

623

📘

Note

When the Searchable property option is changed, the Content type indexing job starts automatically, but you also need to manually run the Content indexing job.

The change is reflected in the GraphQL schema schema with the SearchableStringFilterInput type for fields where this option is enabled. This adds the support for the contains operator.

Search content for searchable fields with _fulltext

The GraphQL querying service generates a special _fulltext field for each content type. This matches the searchable fields on content. The separate values of the searchable fields are preserved, without any overlap between values.

When the Searchable property is enabled for a field, its child elements are also made searchable. The use of the _fulltext field is more efficient than querying for searchable fields separately.

Get searchable field values in content types

The GraphQL querying service lets you get searchable field values (includes its nested field values) in one field _fulltext with array string type on only the top level directly under items. All content types are supported.

Example

{
  Content(locale: en) {
    items {
      Name
      _fulltext
    }
  }
}

Result

{
  "data": {
    "Content": {
      "items": [
        {
          "Name": "Abraham Lincoln",
          "_fulltext": [
            "Abraham Lincoln",
            "With malice toward none; with charity for...",
            "..."
          ]
        },
        {
          "Name": "Vincent Van Gogh",
          "_fulltext": [
            "<h3>Example</h3>",
            "Vincent Van Gogh",
            "..."
          ]
        }
      ]
    }
  }
}