| Type | Name and Description |
|---|---|
int |
child引用类:是否作为子文档索引 |
boolean |
exclude属性是否从索引中排除 |
String[] |
mapping引用类:仅索引其中某些属性,如员工的名称 |
String |
mappingSql多值属性、或联合主键的引用类:获取索引内容的 sql 语句 |
引用类:是否作为子文档索引
默认情况下(-1),相同包下的文档会作为子文档索引其下面的所有(或选择的)属性,而其他包下的文档仅索引其ID; 可以设置为 1,将不在一个包下的文档作为子文档索引,但是子文档类中必须要有反向关联的属性; 也可以设置为0,仅索引相同包下的文档ID,而不是所有属性。
如果配置有 mapping,则本配置始终为 0。
注:不支持联合主键的引用类。
@default int child() default -1属性是否从索引中排除 @default boolean exclude() default false
引用类:仅索引其中某些属性,如员工的名称
格式参考示例,符号“@”前是索引中的字段名、之后是该从对象取值的属性名:
(mapping = ["employeeId@id", "employeeName@name"])
注:不支持联合主键的引用类。
@default String[] mapping() default {}多值属性、或联合主键的引用类:获取索引内容的 sql 语句
格式固定为 select xx as ID, xx as CONTENT from xxx,其中 ID 为所属文档的id、CONTENT 为属性需要索引的内容。
例 String Set:@SearchableField(mappingSql = "select ask_for_leave_id as ID, strings_string as CONTENT from oa_hr_ask_for_leave_strings")
Set<String> strings
static hasMany = [strings: String]
strings joinTable: "oa_hr_ask_for_leave_strings"
例 Map:@SearchableField(mappingSql = "select ask_for_leave_id as ID, concat(concat(key, ' '), value) as CONTENT from oa_hr_ask_for_leave_maps")
Map maps
maps indexColumn: [name: 'key', type: String, length: 10], joinTable: [name: 'oa_hr_ask_for_leave_maps', key: 'ask_for_leave_id', column: 'value']
例 Employee Set:@SearchableField(mappingSql = "select d.ask_for_leave_employees_id as ID, e.name as CONTENT from oa_hr_ask_for_leave_brofwk_osm_employee d inner join brofwk_osm_employee e on d.employee_id=e.id")
Set<Employee> employees
static hasMany = [employees: Employee]
@default String mappingSql() default ""