SOSL Operation Limitations

Two Tooling API objects, EntityDefinition and FieldDefinition, have some SOSL limitations. ExternalString and MetadataComponentDependency (Beta) don’t support SOSL searches.

EntityDefinition and FieldDefinition

EntityDefinition and FieldDefinition support the following SOSL operations:

FIND

  • Literal text search, for example:
    FIND {account}
  • Text search with a single wildcard, for example:
    FIND {account*} RETURNING EntityDefinition
    FIND {account?} RETURNING FieldDefinition
    FIND {account*fax} RETURNING EntityDefintion
    FIND {account?fax} RETURNING FieldDefinition
    The wildcard can’t be the first character in a search term, consistent with search behavior for all objects.
  • Quotation marks are supported.
  • The escape character \ (slash) is supported. For example, to search for the character * (asterisk), include the escape character:
    FIND {account\*}
    RETURNING EntityDefinition
    .
  • RETURNING is required.
    FIND {MyString} 
    RETURNING FieldDefinition
    • Multiple object type names are supported.
      ...RETURNING EntityDefinition, FieldDefinition
    • A field list is supported.
      ... RETURNING EntityDefinition (MasterLabel, QualifiedApiName)
    • WHERE is supported, though logical operators are not.
    • LIMIT is supported.

Example

FIND {account*} 
RETURNING FieldDefinition (MasterLabel, NamespacePrefix 
WHERE EntityDefinitionId='Account')
All other SOSL operations are unsupported. If you include an unsupported expression in a search term, the expression is ignored, except for the following, which cause an error:
  • Multiple wildcards in a search term
  • Unsupported operators OR or NOT
  • Parentheses for grouping operators
  • Morphological tokenization
  • An asterisk wildcard isn’t added at the end of single-character searches.

ExternalString

ExternalString doesn’t support SOSL searches.

MetadataComponentDependency (Beta)

MetadataComponentDependency is a virtual entity, so it doesn’t support SOSL searches.