Last updated by maurice 5 years ago

Searchable Reference

Summary

Used to map searchable references.

Syntax

static searchable = {
    propertyName options
}

static searchable = {
    propertyName reference: true
}

static searchable = {
    propertyName reference: 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 reference.

When you want to change a conventional searchable component mapping (which can happen when the associated class is embedded), you can use either of the last two syntaxes to make it a searchable reference 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
  • @lazy@ - If true the association is lazy when recreating the owing instance for search results. Only applicable to Collections or arrays. Default is @false@

Examples

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

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

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