org.compass.annotations
Annotation Type SearchableMetaData


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

Sepcifies additional meta-data on a SearchableProperty or SearchableId.

SearchableId and SearchableProperty can be used to auto-generate meta-data. If more than one meta-data is required, the SearchableMetaData/SearchableMetaDatas can be used.

The searchable meta-data is meant to handle basic types (which usually translate to a String saved in the search engine). The conversion is done using converters, with Compass providing converters for most basic types. A specialized Converter can be associated with the auto generated meta-data using converter(). The specialized converter will implement the Converter interface, usually extending the AbstractBasicConverter.

Another way of defining a converter for a class can be done using the SearchableClassConverter to annotate the class that needs conversion, with Compass auto detecting it.

Note, that most of the time, a specialized converter for user classes will not be needed, since the SearchableComponent usually makes more sense to use.

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

The searchable property can annotate an array as well, with the array element type used for Converter lookups.

Author:
kimchy

Required Element Summary
 String name
          The name of the meta-data.
 
Optional Element Summary
 String analyzer
          Specifies a specialized analyzer lookup name that will be used to analyze the meta-data content.
 float boost
          The boost level for the meta-data.
 String converter
          The converter lookup name for the given meta-data.
 ExcludeFromAll excludeFromAll
          Specifies if this meta-data should be excluded from the generated "all" meta-data.
 String format
          The format to apply to the value.
 Index index
          Specifies whether and how a meta-data proeprty should be indexed.
 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.
 Reverse reverse
          Specifies whether and how the meta-data proeprty should value will be revered.
 SpellCheck spellCheck
          Should this propety be included in the spell check index.
 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.
 

Element Detail

name

public abstract String name
The name of the meta-data. The name will be the value the contend will be saved under, so it can later be searched using "author:london" (here the name is author).

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

reverse

public abstract Reverse reverse
Specifies whether and how the meta-data proeprty should value will be revered.

Default:
NO

analyzer

public abstract String analyzer
Specifies a specialized analyzer lookup name that will be used to analyze the meta-data content.

Defaults to Compass default analyzer.

Default:
""

excludeFromAll

public abstract ExcludeFromAll excludeFromAll
Specifies if this meta-data should be excluded from the generated "all" meta-data.

See Also:
SearchableAllMetaData.enable()
Default:
NO

converter

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

Defaults to one of Compass internal converters.

Default:
""

format

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

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

spellCheck

public abstract SpellCheck spellCheck
Should this propety be included in the spell check index.

Note, most times this is not requried to be configured, since by default, the spell check index uses the "all" property.

Default:
EXCLUDE


Copyright (c) 2004-2008 The Compass Project.