org.compass.annotations
Annotation Type SearchableReference


@Target(value={METHOD,FIELD})
@Retention(value=RUNTIME)
public @interface SearchableReference

Specifies a searchable reference on property or field of the Searchable class.

A searchable reference is a class field/property that reference another class, and the relationship need to be stored by Compass so it can be traversed when getting the class from the index.

Compass will end up saving only the ids of the referenced class in the search engine index.

The searchalbe reference can annotate a Collection type field/property, supporting either List or Set. The searchable refrence will try and automatically identify the element type using generics, but if the collection is not defined with generics, refAlias() should be used to reference the referenced searchable class mapping definitions.

The searchable compoent can annotate an array as well, with the array element type used for refernced searchable class mapping definitions.

The refence mapping can have a "shadow" component mapping associated with it, if specifing the refComponentAlias().

Author:
kimchy

Optional Element Summary
 String accessor
          The property accessor that will be fetch and write the property value.
 Cascade[] cascade
          The operations that will cascade to the target association.
 String converter
          The conveter lookup name that will convert the ReferenceMapping.
 Lazy lazy
          Should this refernce mapping (only in case of collection) will be lazy or not.
 String refAlias
          The reference alias that points to the searchable class (either defined using annotations or xml).
 String refComponentAlias
          Specifies a reference to a searchable component that will be used to embed some of the referenced class searchable content into the field/property searchable class.
 

refAlias

public abstract String refAlias
The reference alias that points to the searchable class (either defined using annotations or xml). Not required since most of the times it can be automatically detected.

Default:
""

refComponentAlias

public abstract String refComponentAlias
Specifies a reference to a searchable component that will be used to embed some of the referenced class searchable content into the field/property searchable class.

Default:
""

cascade

public abstract Cascade[] cascade
The operations that will cascade to the target association. Defaults to no operations being cascaded.

Default:
{}

converter

public abstract String converter
The conveter lookup name that will convert the ReferenceMapping. Defaults to compass own intenral ReferenceMappingConverter.

Default:
""

accessor

public abstract String accessor
The property accessor that will be fetch and write the property value.

It is automatically set based on where the annotation is used, but can be explicitly set. Compass also supports custom property accessors, registered under a custom name, which can then be used here as well.

Default:
""

lazy

public abstract Lazy lazy
Should this refernce mapping (only in case of collection) will be lazy or not.

Default:
NA


Copyright (c) 2004-2009 The Compass Project.