org.compass.annotations
Annotation Type SearchableDynamicProperty


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

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

Dynamic property is a proeprty where the Resource Property name is dynamic in addition to the value itself.

The annotation can be placed on a custom type (or an array / collection of it). When used on a custom type, the field/property of the custom type for the dynamic name, and the field/property of the custom type for the dynamic value should be explciitly set using nameProperty() and valueProperty(). Another option, instead of setting them, is by using SearchableDynamicName on the custom type field/property and SearchableDynamicValue on the custom type field/property.

The annotation can also be placed on a Map type, where its key will act as the Resource property name and its value will act as the Resource property value. The Map value can also be an array or collection. It is best to use generics when defining the Map.

When annotating a Map, the nameProperty() or valueConverter() (or their respective annotation) can also be used in case the Map key and/or Map value are custom types.

The format for the name can be set using nameFormat() and the format for the value can be set using valueFormat().

Author:
kimchy

Optional Element Summary
 String accessor
          The property accessor that will be fetch and write the property value.
 float boost
          The boost level for the meta-data.
 String converter
          The converter lookup name for the given meta-data.
 Index index
          Specifies whether and how a meta-data proeprty should be indexed.
 String nameConverter
          Explicitly set the name converter lookup name that will be used to convert the name.
 String nameFormat
          The format to apply to the name.
 String namePrefix
          A prefix that will be prepended to the dynamic proeprty names that will be created.
 String nameProperty
          When the name is a custom object, the name property can get field/property from it and use it as the resource property name.
 String nullValue
          A null value to use to store in the index when the property has a null value.
 OmitNorms omitNorms
          Expert: If set, omit normalization factors associated with this indexed field.
 OmitTf omitTf
          Expert: If set, omit tf from postings of this indexed field.
 boolean override
          If there is already an existing id with the same field/property name defined, will override it.
 Store store
          Specifies whether and how a meta-data property will be stored.
 TermVector termVector
          Specifies whether and how a meta-data property should have term vectors.
 String valueConverter
          Explicitly set the value converter lookup name that will be used to convert the value.
 String valueFormat
          The format to apply to the value.
 String valueProperty
          When the name is a custom object, the value property can get field/property from it and use it as the resource property value.
 

namePrefix

public abstract String namePrefix
A prefix that will be prepended to the dynamic proeprty names that will be created.

Default:
""

nameProperty

public abstract String nameProperty
When the name is a custom object, the name property can get field/property from it and use it as the resource property name. Note, the field/property can be marked using SearchableDynamicName annotation as well.

Default:
""

valueProperty

public abstract String valueProperty
When the name is a custom object, the value property can get field/property from it and use it as the resource property value. Note, the field/property can be marked using SearchableDynamicValue annotation as well.

Default:
""

nameFormat

public abstract String nameFormat
The format to apply to the name. Only applies to format-able converters (like dates and numbers).

Default:
""

valueFormat

public abstract String valueFormat
The format to apply to the value. Only applies to format-able converters (like dates and numbers).

Default:
""

nameConverter

public abstract String nameConverter
Explicitly set the name converter lookup name that will be used to convert the name. Note, most times (for example, with Map and generics) the type and converter can be automatically detected.

Default:
""

valueConverter

public abstract String valueConverter
Explicitly set the value converter lookup name that will be used to convert the value. Note, most times (for example, with Map and generics) the type and converter can be automatically detected.

Default:
""

override

public abstract boolean override
If there is already an existing id with the same field/property name defined, will override it.

Default:
true

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:
""

boost

public abstract float boost
The boost level for the meta-data. Will cause hits based on this meta-data to rank higher.

Default:
1.0f

store

public abstract Store store
Specifies whether and how a meta-data property will be stored.

Default:
NA

index

public abstract Index index
Specifies whether and how a meta-data proeprty should be indexed.

Default:
NA

termVector

public abstract TermVector termVector
Specifies whether and how a meta-data property should have term vectors.

Default:
NA

omitNorms

public abstract OmitNorms omitNorms
Expert: If set, omit normalization factors associated with this indexed field. This effectively disables indexing boosts and length normalization for this field.

Default:
NA

omitTf

public abstract OmitTf omitTf
Expert: If set, omit tf from postings of this indexed field.

Default:
NA

converter

public abstract String converter
The converter lookup name for the given meta-data.

Defaults to one of Compass internal converters.

Default:
""

nullValue

public abstract String nullValue
A null value to use to store in the index when the property has a null value. Defaults to not storing null values if the globabl setting of compass.mapping.nullvalue is not set. If it set, disabling the null value can be done by setting it to CompassEnvironment.NullValue.DISABLE_NULL_VALUE_FOR_MAPPING value ($disable$).

Default:
""


Copyright (c) 2004-2009 The Compass Project.