org.compass.annotations
Annotation Type SearchableId


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

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

Each searchable class must have at least one id annotation. The type of the field/property can be a simple type, or a custom class. In case of a custom class, there should be a specialized converter associtaed with it, with the preferable way of defining the converter is to use the SearchableClassConverter annotating the custom class.

A searchable class can have more than one searchable id associated with it.

For simple usage, the annotation can create a SearchableMetaData automatically (without explicitly defining one on the field/property). It will only be created if the name() is set to a value. Most of the attributes that can control the meta-data are provided in the searchable id as well, they are marked in the java doc.

Note, that if the name() is not set, no defined SearchableMetaData will be created, and Compass will end up generating an internal meta-data for it. For additional meta-datas, use the SearchableMetaData or SearchableMetaDatas.

Compass might require an internal meta-data to be created, so it can identify the correct value that match the property/field. Controlling the creation and specifics of the intenal meta-data id can be done using managedId() and managedIdIndex().

Author:
kimchy
See Also:
Searchable, SearchableClassConverter, SearchableMetaData, SearchableMetaDatas

Optional Element Summary
 String accessor
          The property accessor that will be fetch and write the property value.
 String analyzer
          The analyzer of the auto generated SearchableMetaData.
 float boost
          The boost of the auto generated SearchableMetaData.
 String converter
          The converter of the auto generated SearchableMetaData.
 ExcludeFromAll excludeFromAll
          The execlude from all of the auto generated SearchableMetaData.
 String format
          The format of the auto generated SearchableMetaData.
 String idConverter
          Converter that will apply to the id mapping (ClassIdPropertyMapping).
 Index index
          The index of the auto generated SearchableMetaData.
 ManagedId managedId
          Controls if the internal meta-data id creation.
 ManagedIdIndex managedIdIndex
          If the internal meta-data id is created, controls it's index parameter.
 String name
          The name of the auto generated SearchableMetaData.
 OmitNorms omitNorms
          The termVector of the auto generated SearchableMetaData.
 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.
 Reverse reverse
          The reverse of the auto generated SearchableMetaData.
 SpellCheck spellCheck
          Should this propety be included in the spell check index.
 Store store
          The store of the auto generated SearchableMetaData.
 TermVector termVector
          The termVector of the auto generated SearchableMetaData.
 

managedId

public abstract ManagedId managedId
Controls if the internal meta-data id creation.

Default:
AUTO

managedIdIndex

public abstract ManagedIdIndex managedIdIndex
If the internal meta-data id is created, controls it's index parameter.

Default:
NA

override

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

Default:
true

idConverter

public abstract String idConverter
Converter that will apply to the id mapping (ClassIdPropertyMapping). Defaults to the ClassPropertyMapping.

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

name

public abstract String name
The name of the auto generated SearchableMetaData. Maps to SearchableMetaData.name().

The meta-data will be auto generated only if the name has a value.

Default:
""

boost

public abstract float boost
The boost of the auto generated SearchableMetaData. Maps to SearchableMetaData.boost().

The meta-data will be auto generated only if the name has a value.

Default:
1.0f

store

public abstract Store store
The store of the auto generated SearchableMetaData. Maps to SearchableMetaData.store().

The meta-data will be auto generated only if the name has a value.

Default:
NA

index

public abstract Index index
The index of the auto generated SearchableMetaData. Maps to SearchableMetaData.index().

The meta-data will be auto generated only if the name has a value.

Default:
NA

termVector

public abstract TermVector termVector
The termVector of the auto generated SearchableMetaData. Maps to SearchableMetaData.termVector().

The meta-data will be auto generated only if the name has a value.

Default:
NA

omitNorms

public abstract OmitNorms omitNorms
The termVector of the auto generated SearchableMetaData. Maps to SearchableMetaData.omitNorms().

The meta-data will be auto generated only if the name has a value.

Default:
YES

omitTf

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

Default:
YES

reverse

public abstract Reverse reverse
The reverse of the auto generated SearchableMetaData. Maps to SearchableMetaData.reverse().

The meta-data will be auto generated only if the name has a value.

Default:
NO

analyzer

public abstract String analyzer
The analyzer of the auto generated SearchableMetaData. Maps to SearchableMetaData.analyzer().

The meta-data will be auto generated only if the name has a value.

Default:
""

excludeFromAll

public abstract ExcludeFromAll excludeFromAll
The execlude from all of the auto generated SearchableMetaData. Maps to SearchableMetaData.excludeFromAll().

The meta-data will be auto generated only if the name has a value.

Default:
NO

converter

public abstract String converter
The converter of the auto generated SearchableMetaData. Maps to SearchableMetaData.converter(). The meta-data will be auto generated only if the name has a value.

This converter will also be used for an internal meta-data id (if required to be generated).

Default:
""

format

public abstract String format
The format of the auto generated SearchableMetaData. Maps to SearchableMetaData.format(). The meta-data will be auto generated only if the name has a value.

This format will also be used for an internal meta-data id (if required to be generated).

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-2009 The Compass Project.