London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Loading...

Operators

This topic describes operators for fields used with the GraphQL API, for the Optimizely querying service, when retrieving content in Optimizely solutions.

How it works

For every field, you can add an operator to query the content of that field in a particular way.

These are the operators currently supported:

  • contains: Performs full-text search on a word or phrase, with support for language stemming when the locale parameter is added. It is the recommended operator to use when doing full-text search.
  • eq: Matches an exact value, but the value is case-insensitive.
  • notEq: Retrieves results not matching with an exact (but case-insensitive) value.
  • like: Matches substrings with wildcard support. Example: % to match on 0 or more characters, _ to match on any single character. It has case-insensitive matching.
    • Important notes:
      • For fields with type SearchableStringFilterInput, only leading wildcards for the whole value (word or phrase) are supported when wrapped with both a leading and trailing % character. Support for only leading wildcards is not supported and will show an error.
        • Examples:
        • like: "%app%" will match with whole words like "app", "applications", "apple", "apples", and so on, but also a phrase like "Optimizely apps are most awesome!".
        • like: "%ears" will show an error.
      • For fields with type StringFilterInput, matching (on substring) with a leading wildcard is supported.
        • Examples:
        • like: "%pp%" will also match on "app", "applications", "whopper", and so on.
        • like: "%ears" will match on "ears", "bears", "years".
  • gt: Retrieves results with matches that have a value which is greater than the value.
  • gte: Retrieves results with matches that have a value which is greater than or equal to the value.
  • lt: Retrieves results with matches that have a value which is lower than the value.
  • lte: Retrieves results with matches that have a value which is lower than or equal to to the value.
  • exist: Matches results that have this field.
  • startsWith: Retrieves matches that start with a certain value (prefix). It is case-insensitive.
    • Example: startsWith: "eng" will match with "English" or "english", but also "engineering".
  • endsWith: Retrieves matches that end with a certain value (suffix). It is case-insensitive.
    • Example: endsWith: "lish" will match with "English" or "bullish".
  • in: Matches with 1 or more exact values in a list.
    • Example: in: ["word1", "word2", "this is a phrase"]
  • notIn: Returns results that do not match with 1 or more exact values in a list.
    • Example: notIn: ["word1", "word2", "this is a phrase"]

Related topics

Last updated: May 18, 2021