|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.search.fields.CmsSearchField
public class CmsSearchField
An individual field configuration in a search index.
Field Summary | |
---|---|
static float |
BOOST_DEFAULT
Th default boost factor (1.0), used in case no boost has been set for a field. |
static java.lang.String |
FIELD_CATEGORY
Name of the field that contains the (optional) category of the document (hardcoded). |
static java.lang.String |
FIELD_CONTENT
Name of the field that usually contains the complete content of the document (optional). |
static java.lang.String |
FIELD_CONTENT_BLOB
Name of the field that contains the complete extracted content of the document as serialized object (hardcoded). |
static java.lang.String |
FIELD_DATE_CONTENT
Name of the field that contains the document content date (hardcoded). |
static java.lang.String |
FIELD_DATE_CREATED
Name of the field that contains the document creation date (hardcoded). |
static java.lang.String |
FIELD_DATE_LASTMODIFIED
Name of the field that contains the document last modification date (hardcoded). |
static java.lang.String |
FIELD_DESCRIPTION
Name of the field that usually contains the value of the "Description" property of the document (optional). |
static java.lang.String |
FIELD_KEYWORDS
Name of the field that usually contains the value of the "Keywords" property of the document (optional). |
static java.lang.String |
FIELD_META
Name of the field that usually combines all document "meta" information, that is the values of the "Title", "Keywords" and "Description" properties (optional). |
static java.lang.String |
FIELD_PARENT_FOLDERS
Name of the field that contains all VFS parent folders of a document (hardcoded). |
static java.lang.String |
FIELD_PATH
Name of the field that contains the document root path in the VFS (hardcoded). |
static java.lang.String |
FIELD_PRIORITY
Name of the field that contains the (optional) document priority, which can be used to boost the document in the result list (hardcoded). |
static java.lang.String |
FIELD_TITLE
Name of the field that usually contains the value of the "Title" property of the document as a keyword used for sorting and also for retrieving the title text (optional). |
static java.lang.String |
FIELD_TITLE_UNSTORED
Name of the field that usually contains the value of the "Title" property of the document in an analyzed form used for searching in the title (optional). |
static java.lang.String |
FIELD_TYPE
Name of the field that contains the type of the document. |
static java.lang.String |
IGNORE_DISPLAY_NAME
Value of m_displayName if field should not be displayed. |
static java.lang.String |
LUCENE_ANALYZER
Prefix for Lucene default analyzers package ( org.apache.lucene.analysis. |
static java.lang.String |
STR_COMPRESS
Constant for the "compress" index setting. |
static java.lang.String |
STR_NO
Constant for the "no" index setting. |
static java.lang.String |
STR_TOKENIZED
Constant for the "tokenized" index setting. |
static java.lang.String |
STR_UN_TOKENIZED
Constant for the "untokenized" index setting. |
static java.lang.String |
STR_YES
Constant for the "yes" index setting. |
Constructor Summary | |
---|---|
CmsSearchField()
Creates a new search field configuration. |
|
CmsSearchField(java.lang.String name,
java.lang.String displayName,
boolean isStored,
boolean isIndexed)
Creates a new search field configuration. |
|
CmsSearchField(java.lang.String name,
java.lang.String displayName,
boolean isStored,
boolean isCompressed,
boolean isIndexed,
boolean isTokenized,
boolean isInExcerpt,
org.apache.lucene.analysis.Analyzer analyzer,
float boost,
java.lang.String defaultValue)
Creates a new search field configuration. |
|
CmsSearchField(java.lang.String name,
java.lang.String displayName,
boolean isStored,
boolean isIndexed,
boolean isTokenized,
boolean isInExcerpt,
float boost,
java.lang.String defaultValue)
Creates a new search field configuration. |
Method Summary | |
---|---|
void |
addMapping(CmsSearchFieldMapping mapping)
Adds a new field mapping to the internal list of mappings. |
org.apache.lucene.document.Field |
createField(java.lang.String content)
Creates a Lucene field from the configuration and the provided content. |
boolean |
equals(java.lang.Object obj)
Two fields are equal if the name of the Lucene field is equal. |
org.apache.lucene.analysis.Analyzer |
getAnalyzer()
Returns the analyzer used for this field. |
float |
getBoost()
Returns the boost factor of this field. |
java.lang.String |
getBoostDisplay()
Returns the boost factor of thsi field as String value for display use. |
java.lang.String |
getDefaultValue()
Returns the default value to use if no content for this field was collected. |
java.lang.String |
getDisplayName()
Returns the display name of the field. |
java.lang.String |
getDisplayNameForConfiguration()
Returns the displayNameForConfiguration. |
java.lang.String |
getIndexed()
Returns the String value state of this field if it is indexed (and possibly tokenized) in the Lucene index. |
java.util.List<CmsSearchFieldMapping> |
getMappings()
Returns the mappings for this field. |
java.lang.String |
getName()
Returns the name of this field in the Lucene search index. |
int |
hashCode()
The hash code for a field is based only on the field name. |
boolean |
isCompressed()
Returns true if the content of this field is compressed. |
boolean |
isDisplayed()
Returns true if the field should be displayed. |
boolean |
isIndexed()
Returns the indexed. |
boolean |
isInExcerpt()
Returns true if this fields content is used in the search result excerpt. |
boolean |
isInExcerptAndStored()
Returns true if this fields content is used in the search result excerpt. |
boolean |
isStored()
Returns true if the content of this field is stored in the Lucene index. |
boolean |
isTokenized()
Returns true if the content of this field is tokenized in the Lucene index. |
boolean |
isTokenizedAndIndexed()
Returns true if the content of this field is tokenized in the Lucene index. |
void |
setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
Sets the analyzer used for this field. |
void |
setAnalyzer(java.lang.String analyzer)
Sets the analyzer used for this field. |
void |
setBoost(float boost)
Sets the boost factor for this field. |
void |
setBoost(java.lang.String boost)
Sets the boost factor for this field from a String value. |
void |
setBoostDisplay(java.lang.String boost)
Sets the boost factor of this field (only for display use). |
void |
setCompressed(boolean compressed)
Controls if this field value will be stored compressed or not. |
void |
setDefaultValue(java.lang.String defaultValue)
Sets the default value to use if no content for this field was collected. |
void |
setDisplayed(boolean displayed)
Controls if the field is displayed or not. |
void |
setDisplayName(java.lang.String displayName)
Sets the display name. |
void |
setDisplayNameForConfiguration(java.lang.String displayNameForConfiguration)
Sets the displayNameForConfiguration. |
void |
setIndexed(boolean indexed)
Controls if the content of this field is indexed (and possibly tokenized) in the Lucene index. |
void |
setIndexed(java.lang.String indexed)
Controls if the content of this field is indexed (and possibly tokenized) in the Lucene index from a String parameter. |
void |
setInExcerpt(boolean excerpt)
Controls if this fields content is used in the search result excerpt. |
void |
setInExcerpt(java.lang.String excerpt)
Controls if this fields content is used in the search result excerpt. |
void |
setName(java.lang.String name)
Sets the name of this field in the Lucene search index. |
void |
setStored(boolean stored)
Controls if the content of this field is stored in the Lucene index. |
void |
setStored(java.lang.String stored)
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float BOOST_DEFAULT
public static final java.lang.String FIELD_CATEGORY
public static final java.lang.String FIELD_CONTENT
public static final java.lang.String FIELD_CONTENT_BLOB
public static final java.lang.String FIELD_DATE_CONTENT
public static final java.lang.String FIELD_DATE_CREATED
public static final java.lang.String FIELD_DATE_LASTMODIFIED
public static final java.lang.String FIELD_DESCRIPTION
public static final java.lang.String FIELD_KEYWORDS
public static final java.lang.String FIELD_META
public static final java.lang.String FIELD_PATH
public static final java.lang.String FIELD_PRIORITY
public static final java.lang.String FIELD_PARENT_FOLDERS
public static final java.lang.String FIELD_TITLE
FIELD_TITLE_UNSTORED
instead.
public static final java.lang.String FIELD_TITLE_UNSTORED
public static final java.lang.String FIELD_TYPE
public static final java.lang.String IGNORE_DISPLAY_NAME
public static final java.lang.String LUCENE_ANALYZER
org.apache.lucene.analysis.
).
public static final java.lang.String STR_COMPRESS
public static final java.lang.String STR_NO
public static final java.lang.String STR_TOKENIZED
public static final java.lang.String STR_UN_TOKENIZED
public static final java.lang.String STR_YES
Constructor Detail |
---|
public CmsSearchField()
public CmsSearchField(java.lang.String name, java.lang.String displayName, boolean isStored, boolean isIndexed)
The field will be tokenized if it is indexed. The field will not be in the excerpt. The boost value is the default, that is no special boost is used. There is no default value.
name
- the name of the field, see setName(String)
displayName
- the display name of this field, see setDisplayName(String)
isStored
- controls if the field is stored and in the excerpt, see setStored(boolean)
isIndexed
- controls if the field is indexed and tokenized, see setIndexed(boolean)
public CmsSearchField(java.lang.String name, java.lang.String displayName, boolean isStored, boolean isCompressed, boolean isIndexed, boolean isTokenized, boolean isInExcerpt, org.apache.lucene.analysis.Analyzer analyzer, float boost, java.lang.String defaultValue)
name
- the name of the field, see setName(String)
displayName
- the display name of this field, see setDisplayName(String)
isStored
- controls if the field is stored, see setStored(boolean)
isCompressed
- controls if the filed is compressed, see setCompressed(boolean)
isIndexed
- controls if the field is indexed, see setIndexed(boolean)
isTokenized
- controls if the field is tokenized, see setStored(boolean)
isInExcerpt
- controls if the field is in the excerpt, see isInExcerptAndStored()
analyzer
- the Lucene analyzer to use for this fieldboost
- the boost factor for the field, see setBoost(float)
defaultValue
- the default value for the field, see setDefaultValue(String)
public CmsSearchField(java.lang.String name, java.lang.String displayName, boolean isStored, boolean isIndexed, boolean isTokenized, boolean isInExcerpt, float boost, java.lang.String defaultValue)
name
- the name of the field, see setName(String)
displayName
- the display name of this field, see setDisplayName(String)
isStored
- controls if the field is stored, see setStored(boolean)
isIndexed
- controls if the field is indexed, see setIndexed(boolean)
isTokenized
- controls if the field is tokenized, see setStored(boolean)
isInExcerpt
- controls if the field is in the excerpt, see isInExcerptAndStored()
boost
- the boost factor for the field, see setBoost(float)
defaultValue
- the default value for the field, see setDefaultValue(String)
Method Detail |
---|
public void addMapping(CmsSearchFieldMapping mapping)
mapping
- the mapping to addpublic org.apache.lucene.document.Field createField(java.lang.String content)
If no valid content is provided (ie. the content is either null
or
only whitespace), then no field is created and null
is returned.
content
- the content to create the field with
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public org.apache.lucene.analysis.Analyzer getAnalyzer()
public float getBoost()
The boost factor is a Lucene function that controls the "importance" of a field in the
search result ranking. The default is 1.0
. A lower boost factor will make the field
less important for the result ranking, a higher value will make it more important.
public java.lang.String getBoostDisplay()
public java.lang.String getDefaultValue()
In case no default is configured, null
is returned.
public java.lang.String getDisplayName()
public java.lang.String getDisplayNameForConfiguration()
public java.lang.String getIndexed()
isTokenizedAndIndexed()
,
isIndexed()
public java.util.List<CmsSearchFieldMapping> getMappings()
public java.lang.String getName()
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean isCompressed()
true
if the content of this field is compressed.
If the field is compressed, it must also be stored, this means
isStored()
will always return true
for compressed fields.
true
if the content of this field is compressedpublic boolean isDisplayed()
public boolean isIndexed()
public boolean isInExcerpt()
true
if this fields content is used in the search result excerpt.
true
if this fields content is used in the search result excerptisStored()
public boolean isInExcerptAndStored()
true
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 isStored()
.
true
if this fields content is used in the search result excerptisStored()
public boolean isStored()
true
if the content of this field is stored in the Lucene index.
Please refer to the Lucene documentation about Field.Store
for the concept behind stored and unstored fields.
true
if the content of this field is stored in the Lucene indexisTokenizedAndIndexed()
public boolean isTokenized()
true
if the content of this field is tokenized in the Lucene index.
Please refer to the Lucene documentation about Field.Index
for the concept behind tokenized and untokenized fields.
true
if the content of this field is tokenized in the Lucene indexpublic boolean isTokenizedAndIndexed()
true
if the content of this field is tokenized in the Lucene index.
A field can only be tokenized if it is also indexed, see isIndexed()
.
Please refer to the Lucene documentation about Field.Index
for the concept behind tokenized and untokenized fields.
true
if the content of this field is tokenized in the Lucene indexisStored()
,
isIndexed()
public void setAnalyzer(org.apache.lucene.analysis.Analyzer analyzer)
analyzer
- the analyzer to setpublic void setAnalyzer(java.lang.String analyzer) throws java.lang.Exception
The parameter must be a name of a class the implements the Lucene Analyzer
interface.
analyzer
- the analyzer class name to set
java.lang.Exception
- in case of problems creating the analyzer class instancepublic void setBoost(float boost)
The boost factor is a Lucene function that controls the "importance" of a field in the
search result ranking. The default is 1.0
. A lower boost factor will make the field
less important for the result ranking, a higher value will make it more important.
Use with caution: You should only use this if you fully understand the concept behind Lucene boost factors. Otherwise it is likley that your result rankings will be worse then with the default values.
boost
- the boost factor to setpublic void setBoost(java.lang.String boost)
boost
- the boost factor to setsetBoost(float)
public void setBoostDisplay(java.lang.String boost)
boost
- the boost factor to setsetBoost(String)
public void setCompressed(boolean compressed)
If this is set to true
, the value for isStored()
will also
be set to true
, since compressed fields are always stored.
compressed
- if true
, the field value will be stored compressedpublic void setDefaultValue(java.lang.String defaultValue)
defaultValue
- the default value to setpublic void setDisplayed(boolean displayed)
displayed
- if true the field is displayedpublic void setDisplayName(java.lang.String displayName)
displayName
- the display name to setpublic void setDisplayNameForConfiguration(java.lang.String displayNameForConfiguration)
displayNameForConfiguration
- the displayNameForConfiguration to setpublic void setIndexed(boolean indexed)
indexed
- the indexed to setsetTokenized(boolean)
public void setIndexed(java.lang.String indexed)
This sets the values for isIndexed()
as well as isTokenizedAndIndexed()
.
The parameter can have the following values:
indexed
- the index setting to usesetIndexed(boolean)
,
setTokenized(boolean)
public void setInExcerpt(boolean excerpt)
excerpt
- if true
, then this fields content is used in the search excerptpublic void setInExcerpt(java.lang.String excerpt)
excerpt
- if "true"
, then this fields content is used in the search excerptsetInExcerpt(boolean)
public void setName(java.lang.String name)
name
- the name to setpublic void setStored(boolean stored)
Please refer to the Lucene documentation about Field.Store
for the concept behind stored and unstored fields.
stored
- if true
, then the field content is storedsetTokenized(boolean)
public void setStored(java.lang.String stored)
stored
- if "true"
, then the field content is storedsetStored(boolean)
public void setTokenized(boolean tokenized)
Please refer to the Lucene documentation about Field.Index
for the concept behind tokenized and untokenized fields.
tokenized
- if true
, then the field content is tokenizedsetStored(boolean)
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |