Last updated by maurice 5 years ago

Searchable Plugin - Mapping

A searchable class mapping describes how the class instance appears in the index and the data is searched.

This includes things like:

  • Which properties are searchable
  • How a property is processed during indexing - whether it is "analyzed" or not, for example
  • How a property influences the search - whether it has a "boost", for example
  • How associated searchable classes are linked and/or embed one another's searchable data
When you declare

static searchable = true

the plugin maps the class with built-in conventions.

You can override these conventions in a number of ways:

The Mapping DSL

The mapping DSL, is a bit like GORM's mapping DSL.

You can selectively override the built-in conventions for specific properties (or the class itself), and inherit the default behaviour for any properties you do no explicitly map.

Native Compass Mappings

You can also use Compass annotations and Compass XML to map your classes.

With either Compass XML or Compass annotations, you need to map every aspect of the searchable class yourself. In other words, the built-in conventions no longer apply to classes you map with Compass mappings.