org.opencms.search.fields
Class CmsSearchFieldMapping

java.lang.Object
  extended by org.opencms.search.fields.CmsSearchFieldMapping
Direct Known Subclasses:
CmsGallerySearchFieldMapping

public class CmsSearchFieldMapping
extends Object

Describes a mapping of a piece of content from an OpenCms VFS resource to a field of a search index.

Since:
7.0.0

Field Summary
protected static String DATE_EXPIRED_DEFAULT_STR
          Default for expiration date since Long.MAX_VALUE is to big.
 
Constructor Summary
CmsSearchFieldMapping()
          Public constructor for a new search field mapping.
CmsSearchFieldMapping(CmsSearchFieldMappingType type, String param)
          Public constructor for a new search field mapping.
 
Method Summary
 boolean equals(Object obj)
          Two mappings are equal if the type and the parameter is equal.
 String getDefaultValue()
          Returns the default value used for this field mapping in case no content is available.
 String getParam()
          Returns the mapping parameter.
 String getStringValue(CmsObject cms, CmsResource res, I_CmsExtractionResult extractionResult, List<CmsProperty> properties, List<CmsProperty> propertiesSearched)
          Returns the String value extracted form the provided data according to the rules of this mapping type.
 CmsSearchFieldMappingType getType()
          Returns the mapping type.
 int hashCode()
          The hash code depends on the type and the parameter.
 void setDefaultValue(String defaultValue)
          Sets the default value for this field mapping in case no content is available.
 void setParam(String param)
          Sets the mapping parameter.
 void setType(CmsSearchFieldMappingType type)
          Sets the mapping type.
 void setType(String type)
          Sets the mapping type as a String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_EXPIRED_DEFAULT_STR

protected static final String DATE_EXPIRED_DEFAULT_STR
Default for expiration date since Long.MAX_VALUE is to big.

See Also:
Constant Field Values
Constructor Detail

CmsSearchFieldMapping

public CmsSearchFieldMapping()
Public constructor for a new search field mapping.


CmsSearchFieldMapping

public CmsSearchFieldMapping(CmsSearchFieldMappingType type,
                             String param)
Public constructor for a new search field mapping.

Parameters:
type - the type to use, see setType(CmsSearchFieldMappingType)
param - the mapping parameter, see setParam(String)
Method Detail

equals

public boolean equals(Object obj)
Two mappings are equal if the type and the parameter is equal.

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

getDefaultValue

public String getDefaultValue()
Returns the default value used for this field mapping in case no content is available.

Returns:
the default value used for this field mapping in case no content is available

getParam

public String getParam()
Returns the mapping parameter.

The parameter is used depending on the implementation of the rules of the selected CmsSearchFieldMappingType.

Returns:
the mapping parameter

getStringValue

public String getStringValue(CmsObject cms,
                             CmsResource res,
                             I_CmsExtractionResult extractionResult,
                             List<CmsProperty> properties,
                             List<CmsProperty> propertiesSearched)
Returns the String value extracted form the provided data according to the rules of this mapping type.

Parameters:
cms - the OpenCms context used for building the search index
res - the resource that is indexed
extractionResult - the plain text extraction result from the resource
properties - the list of all properties directly attached to the resource (not searched)
propertiesSearched - the list of all searched properties of the resource
Returns:
the String value extracted form the provided data according to the rules of this mapping type

getType

public CmsSearchFieldMappingType getType()
Returns the mapping type.

Returns:
the mapping type

hashCode

public int hashCode()
The hash code depends on the type and the parameter.

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

setDefaultValue

public void setDefaultValue(String defaultValue)
Sets the default value for this field mapping in case no content is available.

Parameters:
defaultValue - the default value to set

setParam

public void setParam(String param)
Sets the mapping parameter.

The parameter is used depending on the implementation of the rules of the selected CmsSearchFieldMappingType.

Parameters:
param - the parameter to set

setType

public void setType(CmsSearchFieldMappingType type)
Sets the mapping type.

Parameters:
type - the type to set

setType

public void setType(String type)
Sets the mapping type as a String.

Parameters:
type - the name of the type to set