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

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

public class SearchableMetaDataMappingBuilder
extends Object

A meta data mapping builder that can be used to define resource properties that will be added to the index. Defined on both property and id based searchable mappings.

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 meta-data using converter(String) or converter(org.compass.core.converter.mapping.ResourcePropertyConverter). The specialized converter will implement the Converter interface, usually extending the AbstractBasicConverter.

Note, that most of the time, a specialized converter for user classes will not be needed, since the SearchableComponentMappingBuilder 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, SearchablePropertyMappingBuilder.type(Class) 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
See Also:
OSEM.metadata(String), SearchablePropertyMappingBuilder.add(SearchableMetaDataMappingBuilder), SearchableIdMappingBuilder.add(SearchableMetaDataMappingBuilder)

Field Summary
(package private)  ClassPropertyMetaDataMapping mapping
           
 
Constructor Summary
SearchableMetaDataMappingBuilder(String name)
           
 
Method Summary
 SearchableMetaDataMappingBuilder analyzer(String analyzer)
          Sets the analyzer logical name that will be used to analyzer the property value.
 SearchableMetaDataMappingBuilder boost(float boost)
          Sets the boost value for the property mapping.
 SearchableMetaDataMappingBuilder converter(Converter converter)
          Sets an actual converter that will be used to convert this property value.
 SearchableMetaDataMappingBuilder converter(ResourcePropertyConverter converter)
          Sets an actual converter that will be used to convert this property value.
 SearchableMetaDataMappingBuilder converter(String converterName)
          Sets the lookup converter name (registered with Compass) that will be used to convert the value of the property.
 SearchableMetaDataMappingBuilder excludeFromAll(ExcludeFromAll excludeFromAll)
          Controls if the property will be excluded from all or not.
 SearchableMetaDataMappingBuilder format(String format)
          Sets the format that will be used for formattable capable converters (such as numbers and dates).
 SearchableMetaDataMappingBuilder index(Property.Index index)
          Specifies whether and how a property should be indexed.
 SearchableMetaDataMappingBuilder nullValue(String nullValue)
          Sets the null value of the property.
 SearchableMetaDataMappingBuilder omitNorms(boolean omitNorms)
          If set, omit normalization factors associated with this indexed field.
 SearchableMetaDataMappingBuilder omitTf(boolean omitTf)
          If set, omit tf from postings of this indexed property.
 SearchableMetaDataMappingBuilder spellCheck(SpellCheck spellCheck)
          Sets the spell check specific setting for the mapping.
 SearchableMetaDataMappingBuilder store(Property.Store store)
          Specifies whether and how a property will be stored.
 SearchableMetaDataMappingBuilder termVector(Property.TermVector termVector)
          Specifies whether and how a property should have term vectors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapping

final ClassPropertyMetaDataMapping mapping
Constructor Detail

SearchableMetaDataMappingBuilder

public SearchableMetaDataMappingBuilder(String name)
Method Detail

store

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


index

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


termVector

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


omitNorms

public SearchableMetaDataMappingBuilder 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 SearchableMetaDataMappingBuilder omitTf(boolean omitTf)
If set, omit tf from postings of this indexed property. Defaults to false.


boost

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


format

public SearchableMetaDataMappingBuilder format(String format)
Sets the format that will be used for formattable capable converters (such as numbers and dates).


converter

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


converter

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


converter

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


analyzer

public SearchableMetaDataMappingBuilder analyzer(String analyzer)
Sets the analyzer logical name that will be used to analyzer the property value. The name is a lookup name for an Analyzer that is registered with Compass.


excludeFromAll

public SearchableMetaDataMappingBuilder excludeFromAll(ExcludeFromAll excludeFromAll)
Controls if the property will be excluded from all or not.


nullValue

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


spellCheck

public SearchableMetaDataMappingBuilder spellCheck(SpellCheck spellCheck)
Sets the spell check specific setting for the mapping.



Copyright (c) 2004-2009 The Compass Project.