org.compass.core.mapping.osem.builder
Class SearchableDynamicPropertyMappingBuilder

java.lang.Object
  extended by org.compass.core.mapping.osem.builder.SearchableDynamicPropertyMappingBuilder

public class SearchableDynamicPropertyMappingBuilder
extends Object

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(String) and valueProperty(String). 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(String) or valueConverter(String) (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(String) and the format for the value can be set using valueFormat(String).

Author:
kimchy
See Also:
OSEM.metadata(String), SearchableMappingBuilder.add(SearchableDynamicPropertyMappingBuilder)

Field Summary
(package private)  ClassDynamicPropertyMapping mapping
           
 
Constructor Summary
SearchableDynamicPropertyMappingBuilder(String name)
           
 
Method Summary
 SearchableDynamicPropertyMappingBuilder accessor(Accessor accessor)
          Sets the acessor the will be used for the class property.
 SearchableDynamicPropertyMappingBuilder accessor(String accessor)
          Sets the acessor the will be used for the class property.
 SearchableDynamicPropertyMappingBuilder boost(float boost)
          Sets the boost value for the property mapping.
 SearchableDynamicPropertyMappingBuilder converter(Converter converter)
          Sets an actual converter that will be used to convert this property value.
 SearchableDynamicPropertyMappingBuilder converter(String converterName)
          Sets the lookup converter name (registered with Compass) that will be used to convert the value of the property.
 SearchableDynamicPropertyMappingBuilder index(Property.Index index)
          Specifies whether and how a property should be indexed.
 SearchableDynamicPropertyMappingBuilder nameConverter(ResourcePropertyConverter nameConverter)
           
 SearchableDynamicPropertyMappingBuilder nameConverter(String nameConverter)
           
 SearchableDynamicPropertyMappingBuilder nameFormat(String nameFormat)
          The format to apply to the name.
 SearchableDynamicPropertyMappingBuilder namePrefix(String namePrefix)
          A prefix that will be prepended to the dynamic proeprty names that will be created.
 SearchableDynamicPropertyMappingBuilder nameProperty(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.
 SearchableDynamicPropertyMappingBuilder nullValue(String nullValue)
          Sets the null value of the property.
 SearchableDynamicPropertyMappingBuilder omitNorms(boolean omitNorms)
          If set, omit normalization factors associated with this indexed field.
 SearchableDynamicPropertyMappingBuilder omitTf(boolean omitTf)
          If set, omit tf from postings of this indexed property.
 SearchableDynamicPropertyMappingBuilder overrideByName(boolean override)
          Sets if this mapping will override another mapping with the same name.
 SearchableDynamicPropertyMappingBuilder store(Property.Store store)
          Specifies whether and how a property will be stored.
 SearchableDynamicPropertyMappingBuilder termVector(Property.TermVector termVector)
          Specifies whether and how a property should have term vectors.
 SearchableDynamicPropertyMappingBuilder valueConverter(ResourcePropertyConverter valueConverter)
           
 SearchableDynamicPropertyMappingBuilder valueConverter(String valueConverter)
           
 SearchableDynamicPropertyMappingBuilder valueFormat(String valueFormat)
          The format to apply to the value.
 SearchableDynamicPropertyMappingBuilder valueProperty(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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapping

final ClassDynamicPropertyMapping mapping
Constructor Detail

SearchableDynamicPropertyMappingBuilder

public SearchableDynamicPropertyMappingBuilder(String name)
Method Detail

namePrefix

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


nameProperty

public SearchableDynamicPropertyMappingBuilder nameProperty(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.


valueProperty

public SearchableDynamicPropertyMappingBuilder valueProperty(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.


nameFormat

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


valueFormat

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


nameConverter

public SearchableDynamicPropertyMappingBuilder nameConverter(String nameConverter)

nameConverter

public SearchableDynamicPropertyMappingBuilder nameConverter(ResourcePropertyConverter nameConverter)

valueConverter

public SearchableDynamicPropertyMappingBuilder valueConverter(String valueConverter)

valueConverter

public SearchableDynamicPropertyMappingBuilder valueConverter(ResourcePropertyConverter valueConverter)

overrideByName

public SearchableDynamicPropertyMappingBuilder overrideByName(boolean override)
Sets if this mapping will override another mapping with the same name. Defaults to true.


accessor

public SearchableDynamicPropertyMappingBuilder accessor(Accessor accessor)
Sets the acessor the will be used for the class property. Defaults to property (getter and optionally setter).


accessor

public SearchableDynamicPropertyMappingBuilder accessor(String accessor)
Sets the acessor the will be used for the class property. Defaults to property (getter and optionally setter). Note, this is the lookup name of a PropertyAccessor registered with Compass, with two default ones (custom ones can be easily added) named field and property.


store

public SearchableDynamicPropertyMappingBuilder store(Property.Store store)
Specifies whether and how a property will be stored. Deftauls to Property.Store.YES.


index

public SearchableDynamicPropertyMappingBuilder index(Property.Index index)
Specifies whether and how a property should be indexed. Defaults to Property.Index.ANALYZED.


termVector

public SearchableDynamicPropertyMappingBuilder termVector(Property.TermVector termVector)
Specifies whether and how a property should have term vectors. Defaults to Property.TermVector.NO.


omitNorms

public SearchableDynamicPropertyMappingBuilder omitNorms(boolean omitNorms)
If set, omit normalization factors associated with this indexed field. This effectively disables indexing boosts and length normalization for this field. Defaults to false.


omitTf

public SearchableDynamicPropertyMappingBuilder omitTf(boolean omitTf)
If set, omit tf from postings of this indexed property. Defaults to false.


boost

public SearchableDynamicPropertyMappingBuilder boost(float boost)
Sets the boost value for the property mapping. Defaults to 1.0f.


converter

public SearchableDynamicPropertyMappingBuilder converter(String converterName)
Sets the lookup converter name (registered with Compass) that will be used to convert the value of the property.


converter

public SearchableDynamicPropertyMappingBuilder converter(Converter converter)
Sets an actual converter that will be used to convert this property value.


nullValue

public SearchableDynamicPropertyMappingBuilder nullValue(String nullValue)
Sets the null value of the property. If the property value is null, will store in the index the provided value.



Copyright (c) 2004-2009 The Compass Project.