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.
 boolean 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.
 Reverse reverse
          Specifies whether and how the meta-data proeprty should value will be revered.
 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:
YES

index

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

Default:
TOKENIZED

termVector

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

Default:
NO

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 boolean excludeFromAll
Specifies if this meta-data should be excluded from the generated "all" meta-data.

See Also:
Searchable.enableAll()
Default:
false

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


Copyright (c) 2004-2006 The Compass Project.