Last updated by Shailen
4 years ago
Not All Properties
Using only and except
You can limit the properties that are made searchable like:class Post {
static searchable = [only: ['category', 'title']]
// …
}class Post {
static searchable = [except: 'createdAt']
// …
}- * means any number of characters
- ? means any single character
except and only wildcard examples
// map, eg, 'addressLine1', 'addressLine2', 'addressPostcode', etc…
static searchable = [only: 'address*']// do not map, eg, 'screenX' and 'screenY' and 'version' static searchable = [except: ['screen?', 'version']]
Using except or only with class property mapping
You can combine class property mappings with only and except:class Post {
static searchable = {
except = ["version", "createdAt"] // version and createdAt will not be mapped to the index
category index: 'not_analyzed', excludeFromAll: true
title boost: 2.0
comments component: true
}
static hasMany = [comments: Comment] User author
String title, post, category
Date createdAt
}