Package org.opencms.search.fields
Class CmsSearchFieldMapping
java.lang.Object
org.opencms.search.fields.CmsSearchFieldMapping
- All Implemented Interfaces:
Serializable
,I_CmsSearchFieldMapping
- Direct Known Subclasses:
CmsMacroResolvingSearchFieldMapping
Describes a mapping of a piece of content from an OpenCms VFS resource to a field of a search index.
- Since:
- 7.0.0
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPublic constructor for a new search field mapping.CmsSearchFieldMapping
(boolean isLucene) Public constructor for a new search field mapping.CmsSearchFieldMapping
(CmsSearchFieldMappingType type, String param) Public constructor for a new search field mapping.CmsSearchFieldMapping
(CmsSearchFieldMappingType type, String param, boolean isLucene) Public constructor for a new search field mapping. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Two mappings are equal if the type and the parameter is equal.static Date
Returns the default expiration date, meaning the resource never expires.Returns the default value used for this field mapping in case no content is available.getParam()
Returns the mapping parameter.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.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
Sets the locale, the mapping can examine when extracting the content.void
Sets the mapping parameter.void
Sets the mapping type as a String.void
Sets the mapping type.
-
Field Details
-
m_locale
The locale to extract content items in.
-
-
Constructor Details
-
CmsSearchFieldMapping
public CmsSearchFieldMapping()Public constructor for a new search field mapping. -
CmsSearchFieldMapping
Public constructor for a new search field mapping.- Parameters:
isLucene
- flag, indicating if the mapping is done for a lucene index
-
CmsSearchFieldMapping
Public constructor for a new search field mapping.- Parameters:
type
- the type to use, seesetType(CmsSearchFieldMappingType)
param
- the mapping parameter, seesetParam(String)
-
CmsSearchFieldMapping
Public constructor for a new search field mapping.- Parameters:
type
- the type to use, seesetType(CmsSearchFieldMappingType)
param
- the mapping parameter, seesetParam(String)
isLucene
- flag, indicating if the mapping is done for a lucene index
-
-
Method Details
-
getDefaultDateExpired
Returns the default expiration date, meaning the resource never expires.- Returns:
- the default expiration date
- Throws:
ParseException
- if something goes wrong parsing the default date string
-
equals
Two mappings are equal if the type and the parameter is equal. -
getDefaultValue
Description copied from interface:I_CmsSearchFieldMapping
Returns the default value used for this field mapping in case no content is available.- Specified by:
getDefaultValue
in interfaceI_CmsSearchFieldMapping
- Returns:
- the default value used for this field mapping in case no content is available
- See Also:
-
getParam
Description copied from interface:I_CmsSearchFieldMapping
Returns the mapping parameter.The parameter is used depending on the implementation of the rules of the selected
CmsSearchFieldMappingType
.- Specified by:
getParam
in interfaceI_CmsSearchFieldMapping
- Returns:
- the mapping parameter
- See Also:
-
getStringValue
public String getStringValue(CmsObject cms, CmsResource res, I_CmsExtractionResult extractionResult, List<CmsProperty> properties, List<CmsProperty> propertiesSearched) Description copied from interface:I_CmsSearchFieldMapping
Returns the String value extracted form the provided data according to the rules of this mapping type.- Specified by:
getStringValue
in interfaceI_CmsSearchFieldMapping
- Parameters:
cms
- the OpenCms context used for building the search indexres
- the resource that is indexedextractionResult
- the plain text extraction result from the resourceproperties
- 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
- See Also:
-
getType
Description copied from interface:I_CmsSearchFieldMapping
Returns the mapping type.- Specified by:
getType
in interfaceI_CmsSearchFieldMapping
- Returns:
- the mapping type
- See Also:
-
hashCode
The hash code depends on the type and the parameter. -
setDefaultValue
Description copied from interface:I_CmsSearchFieldMapping
Sets the default value for this field mapping in case no content is available.- Specified by:
setDefaultValue
in interfaceI_CmsSearchFieldMapping
- Parameters:
defaultValue
- the default value to set- See Also:
-
setLocale
Description copied from interface:I_CmsSearchFieldMapping
Sets the locale, the mapping can examine when extracting the content. NOTE: This method is called byCmsDefaultXmlContentHandler
when dynamic search field mappings are created. Overwrite this default implementation if you need to map locale specific in your dynamic mapping.- Specified by:
setLocale
in interfaceI_CmsSearchFieldMapping
- Parameters:
locale
- the locale of the index field that is filled by the mapping.- See Also:
-
setParam
Description copied from interface:I_CmsSearchFieldMapping
Sets the mapping parameter.The parameter is used depending on the implementation of the rules of the selected
CmsSearchFieldMappingType
.- Specified by:
setParam
in interfaceI_CmsSearchFieldMapping
- Parameters:
param
- the parameter to set- See Also:
-
setType
Description copied from interface:I_CmsSearchFieldMapping
Sets the mapping type.- Specified by:
setType
in interfaceI_CmsSearchFieldMapping
- Parameters:
type
- the type to set- See Also:
-
setType
Description copied from interface:I_CmsSearchFieldMapping
Sets the mapping type as a String.- Specified by:
setType
in interfaceI_CmsSearchFieldMapping
- Parameters:
type
- the name of the type to set- See Also:
-