Class CmsLuceneField
- All Implemented Interfaces:
Serializable
- Since:
- 7.0.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Value of m_displayName if field should not be displayed.static final String
Constant for the "compress" index setting.static final String
Constant for the "no" index setting.static final String
Constant for the "tokenized" index setting.static final String
Constant for the "untokenized" index setting.static final String
Constant for the "yes" index setting.Fields inherited from class org.opencms.search.fields.CmsSearchField
FIELD_CATEGORY, FIELD_CATEGORY_EXACT, FIELD_CONTENT, FIELD_CONTENT_BLOB, FIELD_CONTENT_LOCALES, FIELD_DATE_CONTENT, FIELD_DATE_CREATED, FIELD_DATE_CREATED_LOOKUP, FIELD_DATE_EXPIRED, FIELD_DATE_LASTMODIFIED, FIELD_DATE_LASTMODIFIED_LOOKUP, FIELD_DATE_LOOKUP_SUFFIX, FIELD_DATE_RELEASED, FIELD_DEPENDENCY_TYPE, FIELD_DESCRIPTION, FIELD_DISPORDER, FIELD_DISPTITLE, FIELD_DYNAMIC_EXACT, FIELD_DYNAMIC_PROPERTIES, FIELD_DYNAMIC_PROPERTIES_DIRECT, FIELD_EXCERPT, FIELD_FILENAME, FIELD_GEOCOORDS, FIELD_ID, FIELD_INSTANCEDATE, FIELD_INSTANCEDATE_CURRENT_TILL, FIELD_INSTANCEDATE_END, FIELD_INSTANCEDATE_RANGE, FIELD_KEYWORDS, FIELD_LINK, FIELD_META, FIELD_MIMETYPE, FIELD_PARENT_FOLDERS, FIELD_PATH, FIELD_PATH_HIERARCHY, FIELD_PLACE, FIELD_POSTFIX_DATE, FIELD_POSTFIX_DATE_RANGE, FIELD_POSTFIX_DATE_RANGES, FIELD_POSTFIX_DATES, FIELD_POSTFIX_INT, FIELD_POSTFIX_LOC, FIELD_POSTFIX_SORT, FIELD_POSTFIX_STRING, FIELD_PREFIX_DEPENDENCY, FIELD_PREFIX_DYNAMIC, FIELD_PREFIX_TEXT, FIELD_PRIORITY, FIELD_RESOURCE_LOCALES, FIELD_SCORE, FIELD_SEARCH_CHANNEL, FIELD_SEARCH_EXCLUDE, FIELD_SERIESDATES, FIELD_SERIESDATES_CURRENT_TILL, FIELD_SERIESDATES_END, FIELD_SERIESDATES_TYPE, FIELD_SIZE, FIELD_SOLR_ID, FIELD_SORT_TITLE, FIELD_SPELL, FIELD_STATE, FIELD_SUFFIX, FIELD_TEXT, FIELD_TEXT_DE, FIELD_TEXT_EL, FIELD_TEXT_EN, FIELD_TEXT_ES, FIELD_TEXT_FR, FIELD_TEXT_HU, FIELD_TEXT_IT, FIELD_TIMESTAMP, FIELD_TITLE, FIELD_TITLE_UNSTORED, FIELD_TYPE, FIELD_USER_CREATED, FIELD_USER_LAST_MODIFIED, FIELD_VERSION
-
Constructor Summary
ConstructorDescriptionCreates a new search field configuration.CmsLuceneField
(String name, String displayName, boolean isStored, boolean isIndexed) Creates a new search field configuration.CmsLuceneField
(String name, String displayName, boolean isStored, boolean isCompressed, boolean isIndexed, boolean isTokenized, boolean isInExcerpt, org.apache.lucene.analysis.Analyzer analyzer, String defaultValue) Creates a new search field configuration.CmsLuceneField
(String name, String displayName, boolean isStored, boolean isIndexed, boolean isTokenized, boolean isInExcerpt, String defaultValue) Creates a new search field configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes the analyzer.org.apache.lucene.document.Field
createField
(String content) Creates a field from the configuration and the provided content.org.apache.lucene.document.Field
createField
(String name, String content) Creates a field with the given name from the configuration and the provided content.org.apache.lucene.analysis.Analyzer
Returns the analyzer used for this field.Returns the display name of the field.Returns the displayNameForConfiguration.Returns the String value state of this field if it is indexed (and possibly tokenized) in the Lucene index.getType()
Returns the type.boolean
Returnstrue
if the content of this field is compressed.boolean
Returns true if the field should be displayed.boolean
Returnstrue
if this fields content is used in the search result excerpt.boolean
Returnstrue
if the content of this field is tokenized in the Lucene index.boolean
Returnstrue
if the content of this field is tokenized in the Lucene index.void
setAnalyzer
(String analyzerName) Sets the analyzer used for this field.void
setAnalyzer
(org.apache.lucene.analysis.Analyzer analyzer) Sets the analyzer used for this field.void
setCompressed
(boolean compressed) Controls if this field value will be stored compressed or not.void
setDisplayed
(boolean displayed) Controls if the field is displayed or not.void
setDisplayName
(String displayName) Sets the display name.void
setDisplayNameForConfiguration
(String displayNameForConfiguration) Sets the displayNameForConfiguration.void
setIndexed
(String indexed) Controls if the content of this field is indexed (and possibly tokenized) in the Lucene index from a String parameter.void
setInExcerpt
(String excerpt) Controls if this fields content is used in the search result excerpt.void
Controls if the content of this field is stored in the Lucene index from a String parameter.void
setTokenized
(boolean tokenized) Controls if the content of this field is tokenized in the Lucene index.void
Sets the type.Methods inherited from class org.opencms.search.fields.CmsSearchField
addMapping, addUninvertingMappings, equals, getDefaultValue, getMappings, getName, hashCode, isIndexed, isInExcerpt, isStored, setDefaultValue, setIndexed, setInExcerpt, setName, setStored, toString
-
Field Details
-
IGNORE_DISPLAY_NAME
Value of m_displayName if field should not be displayed.- See Also:
-
STR_COMPRESS
Constant for the "compress" index setting.- See Also:
-
STR_NO
Constant for the "no" index setting.- See Also:
-
STR_TOKENIZED
Constant for the "tokenized" index setting.- See Also:
-
STR_UN_TOKENIZED
Constant for the "untokenized" index setting.- See Also:
-
STR_YES
Constant for the "yes" index setting.- See Also:
-
-
Constructor Details
-
CmsLuceneField
public CmsLuceneField()Creates a new search field configuration. -
CmsLuceneField
Creates a new search field configuration.The field will be tokenized if it is indexed. The field will not be in the excerpt. There is no default value.
- Parameters:
name
- the name of the field, seeCmsSearchField.setName(String)
displayName
- the display name of this field, seesetDisplayName(String)
isStored
- controls if the field is stored and in the excerpt, seeCmsSearchField.setStored(boolean)
isIndexed
- controls if the field is indexed and tokenized, seeCmsSearchField.setIndexed(boolean)
-
CmsLuceneField
public CmsLuceneField(String name, String displayName, boolean isStored, boolean isCompressed, boolean isIndexed, boolean isTokenized, boolean isInExcerpt, org.apache.lucene.analysis.Analyzer analyzer, String defaultValue) Creates a new search field configuration.- Parameters:
name
- the name of the field, seeCmsSearchField.setName(String)
displayName
- the display name of this field, seesetDisplayName(String)
isStored
- controls if the field is stored, seeCmsSearchField.setStored(boolean)
isCompressed
- controls if the filed is compressed, seesetCompressed(boolean)
isIndexed
- controls if the field is indexed, seeCmsSearchField.setIndexed(boolean)
isTokenized
- controls if the field is tokenized, seeCmsSearchField.setStored(boolean)
isInExcerpt
- controls if the field is in the excerpt, seeisInExcerptAndStored()
analyzer
- the analyzer to use, seesetAnalyzer(Analyzer)
defaultValue
- the default value for the field, seeCmsSearchField.setDefaultValue(String)
-
CmsLuceneField
public CmsLuceneField(String name, String displayName, boolean isStored, boolean isIndexed, boolean isTokenized, boolean isInExcerpt, String defaultValue) Creates a new search field configuration.- Parameters:
name
- the name of the field, seeCmsSearchField.setName(String)
displayName
- the display name of this field, seesetDisplayName(String)
isStored
- controls if the field is stored, seeCmsSearchField.setStored(boolean)
isIndexed
- controls if the field is indexed, seeCmsSearchField.setIndexed(boolean)
isTokenized
- controls if the field is tokenized, seeCmsSearchField.setStored(boolean)
isInExcerpt
- controls if the field is in the excerpt, seeisInExcerptAndStored()
defaultValue
- the default value for the field, seeCmsSearchField.setDefaultValue(String)
-
-
Method Details
-
closeAnalyzer
Closes the analyzer. -
createField
Creates a field from the configuration and the provided content.The configured name of the field as provided by
CmsSearchField.getName()
is used.If no valid content is provided (that is the content is either
null
or only whitespace), then no field is created andnull
is returned.- Parameters:
content
- the content to create the field with- Returns:
- a field created from the configuration and the provided content
-
createField
Creates a field with the given name from the configuration and the provided content.If no valid content is provided (that is the content is either
null
or only whitespace), then no field is created andnull
is returned.- Parameters:
name
- the name of the field to createcontent
- the content to create the field with- Returns:
- a field with the given name from the configuration and the provided content
-
getAnalyzer
Returns the analyzer used for this field.- Returns:
- the analyzer used for this field
-
getDisplayName
Returns the display name of the field.- Returns:
- the display name of the field
-
getDisplayNameForConfiguration
Returns the displayNameForConfiguration.- Returns:
- the displayNameForConfiguration
-
getIndexed
Returns the String value state of this field if it is indexed (and possibly tokenized) in the Lucene index.- Overrides:
getIndexed
in classCmsSearchField
- Returns:
- the String value state of this field if it is indexed (and possibly tokenized) in the Lucene index
- See Also:
-
getType
Returns the type.- Returns:
- the type
-
isCompressed
Returnstrue
if the content of this field is compressed.If the field is compressed, it must also be stored, this means
CmsSearchField.isStored()
will always returntrue
for compressed fields.- Returns:
true
if the content of this field is compressed
-
isDisplayed
Returns true if the field should be displayed.- Returns:
- returns true if the field should be displayed otherwise false
-
isInExcerptAndStored
Returnstrue
if this fields content is used in the search result excerpt.A field can only be used in the excerpt if it is stored, see
CmsSearchField.isStored()
.- Returns:
true
if this fields content is used in the search result excerpt- See Also:
-
isTokenized
Returnstrue
if the content of this field is tokenized in the Lucene index.Please refer to the Lucene documentation about the concept behind tokenized and untokenized fields.
- Returns:
true
if the content of this field is tokenized in the Lucene index
-
isTokenizedAndIndexed
Returnstrue
if the content of this field is tokenized in the Lucene index.A field can only be tokenized if it is also indexed, see
CmsSearchField.isIndexed()
.Please refer to the Lucene documentation about the concept behind tokenized and untokenized fields.
- Returns:
true
if the content of this field is tokenized in the Lucene index- See Also:
-
setAnalyzer
Sets the analyzer used for this field.- Parameters:
analyzer
- the analyzer to set
-
setAnalyzer
Sets the analyzer used for this field.The parameter must be a name of a class the implements the Lucene
Analyzer
interface.- Parameters:
analyzerName
- the analyzer class name to set- Throws:
Exception
- in case of problems creating the analyzer class instance
-
setCompressed
Controls if this field value will be stored compressed or not.If this is set to
true
, the value forCmsSearchField.isStored()
will also be set totrue
, since compressed fields are always stored.- Parameters:
compressed
- iftrue
, the field value will be stored compressed
-
setDisplayed
Controls if the field is displayed or not.- Parameters:
displayed
- if true the field is displayed
-
setDisplayName
Sets the display name. If the given name equals IGNORE_DISPLAY_NAME the field is not displayed.- Parameters:
displayName
- the display name to set
-
setDisplayNameForConfiguration
Sets the displayNameForConfiguration.- Parameters:
displayNameForConfiguration
- the displayNameForConfiguration to set
-
setIndexed
Controls if the content of this field is indexed (and possibly tokenized) in the Lucene index from a String parameter.This sets the values for
CmsSearchField.isIndexed()
as well asisTokenizedAndIndexed()
.The parameter can have the following values:
- "true" or "tokenized": The field is indexed and tokenized.
- "false" or "no": The field is not indexed and not tokenized.
- "untokenized": The field is indexed but not tokenized.
- Parameters:
indexed
- the index setting to use- See Also:
-
setInExcerpt
Controls if this fields content is used in the search result excerpt.- Parameters:
excerpt
- if"true"
, then this fields content is used in the search excerpt- See Also:
-
setStored
Controls if the content of this field is stored in the Lucene index from a String parameter.- Parameters:
stored
- if"true"
, then the field content is stored- See Also:
-
setTokenized
Controls if the content of this field is tokenized in the Lucene index.Please refer to the Lucene documentation about the concept behind tokenized and untokenized fields.
- Parameters:
tokenized
- iftrue
, then the field content is tokenized- See Also:
-
setType
Sets the type.- Parameters:
type
- the type to set
-