Last updated by maurice 5 years ago

Searchable Component

Summary

Used to map searchable components.

Syntax

static searchable = {
    propertyName options
}

static searchable = {
    propertyName component: true
}

static searchable = {
    propertyName component: options
}

Description

Maps the class's propertyName property with the given options.

You can use all three syntaxes when a conventional mapping would give you a searchable component.

When you want to change a conventional searchable reference mapping (which is the normally how domain class associations are mapped), you can use either of the last two syntaxes to make it a searchable component instead.

Parameters

Options

  • @accessor@ - How the property is accessed. One of "field" or @"property"@. Default is @"property"@
  • @cascade@ - The operations to cascade to the target association. A String comma-delimited-list of values in "all"@, @"create"@, @"save" and @"delete"@.
  • @converter@ - The name of a configured converter to use to convert the property value to/from text
  • @maxDepth@ - The depth of cyclic component references allowed. Default is @1@
  • @prefix@ - A String prefix to apply to the component's properties. A prefix can be used to distinguish between multiple components of the same type. Without a prefix you can search within a component's properties with their property names, eg, "city:london"@, with a prefix like @'homeAddress$' you can search for @'homeAddress$city:london'@

Examples

// Provide a custom converter
metadata converter: "metadata_converter"

// Map metadata as a component, overriding any conventional mapping
metadata component: true

// Map metadata as a component, overriding any conventional mapping
// and define some options
metadata component: [converter: "metadata_converter"]