public class CmsSearchFieldConfiguration extends java.lang.Object implements java.lang.Comparable<CmsSearchFieldConfiguration>, I_CmsSearchFieldAppdender
限定符和类型 | 字段和说明 |
---|---|
static java.util.List<java.lang.String> |
LAZY_FIELDS
A list of fields that should be lazy-loaded.
|
static java.lang.String |
STR_STANDARD
The name for the standard field configuration.
|
构造器和说明 |
---|
CmsSearchFieldConfiguration()
Creates a new, empty field configuration.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addAdditionalFields()
Add the additional fields to the configuration.
|
void |
addField(CmsSearchField field)
Adds a field to this search field configuration.
|
void |
addFields(java.util.Collection<CmsSearchField> fields)
Adds fields.
|
protected I_CmsSearchDocument |
appendCategories(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extractionResult,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Extends the given document by resource category information based on properties.
|
protected I_CmsSearchDocument |
appendContentBlob(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extractionResult,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Extends the given document by a field that contains the extracted content blob.
|
protected I_CmsSearchDocument |
appendDates(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extractionResult,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Extends the given document by fields for date of creation, content and last modification.
|
protected I_CmsSearchDocument |
appendFieldMapping(I_CmsSearchDocument document,
CmsSearchField field,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extractionResult,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Extends the given document by the mappings for the given field.
|
protected I_CmsSearchDocument |
appendFieldMappings(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extractionResult,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Extends the given document by the configured field mappings.
|
I_CmsSearchDocument |
appendFields(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extractionResult,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Appends the specific search fields to the document.
|
protected I_CmsSearchDocument |
appendFileSize(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extractionResult,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Extends the given document by the "size" field.
|
protected I_CmsSearchDocument |
appendLocales(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extraction,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Extends the given document by the "res_locales" field.
|
protected I_CmsSearchDocument |
appendPath(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extractionResult,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Extends the given document by fields for VFS path lookup.
|
protected I_CmsSearchDocument |
appendProperties(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extraction,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Appends all direct properties, that are not empty or white space only to the document.
|
protected I_CmsSearchDocument |
appendType(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extractionResult,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Extends the given document by a field that contains the resource type name.
|
int |
compareTo(CmsSearchFieldConfiguration obj) |
I_CmsSearchDocument |
createDocument(CmsObject cms,
CmsResource resource,
CmsSearchIndex index,
I_CmsExtractionResult extraction)
Creates the Lucene Document with this field configuration for the provided VFS resource, search index and content.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getDescription()
Returns the description of this field configuration.
|
CmsSearchField |
getField(java.lang.String name)
Returns the configured
CmsSearchField instance with the given name. |
java.util.List<java.lang.String> |
getFieldNames()
Returns the list of configured field names (Strings).
|
java.util.List<CmsSearchField> |
getFields()
Returns the list of configured
CmsSearchField instances. |
CmsSearchIndex |
getIndex()
Returns the index.
|
static java.lang.String |
getLocaleExtendedName(java.lang.String lookup,
java.util.Locale locale)
Returns the locale extended name for the given lookup String.
|
static java.lang.String |
getLocaleExtendedName(java.lang.String lookup,
java.lang.String locale)
Returns the locale extended name for the given lookup String.
|
java.lang.String |
getName()
Returns the name of this field configuration.
|
static java.lang.String |
getParentFolderTokens(java.lang.String rootPath)
Creates a space separated list of all parent folders of the given root path.
|
int |
hashCode() |
void |
init()
Initializes this field configuration.
|
protected I_CmsSearchDocument |
setBoost(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extractionResult,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Extends the given document with a boost factor.
|
void |
setDescription(java.lang.String description)
Sets the description of this field configuration.
|
void |
setIndex(CmsSearchIndex index)
Sets the index.
|
void |
setName(java.lang.String name)
Sets the name of this field configuration.
|
public static final java.util.List<java.lang.String> LAZY_FIELDS
public static final java.lang.String STR_STANDARD
public CmsSearchFieldConfiguration()
public static final java.lang.String getLocaleExtendedName(java.lang.String lookup, java.util.Locale locale)
lookup
- the lookup Stringlocale
- the localepublic static final java.lang.String getLocaleExtendedName(java.lang.String lookup, java.lang.String locale)
lookup
- the lookup Stringlocale
- the localepublic static java.lang.String getParentFolderTokens(java.lang.String rootPath)
rootPath
- the root path to get the parent folder list forpublic void addAdditionalFields()
I_CmsSearchFieldAppdender
public void addField(CmsSearchField field)
field
- the field to addpublic void addFields(java.util.Collection<CmsSearchField> fields)
fields
- the fields to addpublic I_CmsSearchDocument appendFields(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
appendFields
在接口中 I_CmsSearchFieldAppdender
document
- the document to append field(s)cms
- the CMS object used during indexing processresource
- the resource that is currently indexedextractionResult
- the extraction result of this resourceproperties
- CmsObject.readPropertyObjects(CmsResource, boolean)
with falsepropertiesSearched
- CmsObject.readPropertyObjects(CmsResource, boolean)
with trueI_CmsSearchFieldAppdender.appendFields(org.opencms.search.I_CmsSearchDocument, org.opencms.file.CmsObject, org.opencms.file.CmsResource, org.opencms.search.extractors.I_CmsExtractionResult, java.util.List, java.util.List)
public int compareTo(CmsSearchFieldConfiguration obj)
compareTo
在接口中 java.lang.Comparable<CmsSearchFieldConfiguration>
Comparable.compareTo(java.lang.Object)
public I_CmsSearchDocument createDocument(CmsObject cms, CmsResource resource, CmsSearchIndex index, I_CmsExtractionResult extraction) throws CmsException
This triggers the indexing process for the given VFS resource according to the configuration of the provided index.
The provided index resource contains the basic contents to index. The provided search index contains the configuration what to index, such as the locale and possible special field mappings.
cms
- the OpenCms user context used to access the OpenCms VFSresource
- the resource to create the Lucene document fromindex
- the search index to create the Document forextraction
- the plain text content extracted from the documentCmsException
- if something goes wrongpublic boolean equals(java.lang.Object obj)
equals
在类中 java.lang.Object
Object.equals(java.lang.Object)
public java.lang.String getDescription()
public CmsSearchField getField(java.lang.String name)
CmsSearchField
instance with the given name.name
- the search field name to look upCmsSearchField
instance with the given namepublic java.util.List<java.lang.String> getFieldNames()
public java.util.List<CmsSearchField> getFields()
CmsSearchField
instances.CmsSearchField
instancespublic CmsSearchIndex getIndex()
public java.lang.String getName()
public int hashCode()
hashCode
在类中 java.lang.Object
Object.hashCode()
public void init()
public void setDescription(java.lang.String description)
description
- the description to setpublic void setIndex(CmsSearchIndex index)
index
- the index to setpublic void setName(java.lang.String name)
name
- the name to setprotected I_CmsSearchDocument appendCategories(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched) throws CmsException
document
- the document to extendcms
- the OpenCms context used for building the search indexresource
- 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 resourceCmsException
- if something goes wrongprotected I_CmsSearchDocument appendContentBlob(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
document
- the document to extendcms
- the OpenCms context used for building the search indexresource
- 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 resourceprotected I_CmsSearchDocument appendDates(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
document
- the document to extendcms
- the OpenCms context used for building the search indexresource
- 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 resourceprotected I_CmsSearchDocument appendFieldMapping(I_CmsSearchDocument document, CmsSearchField field, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
document
- the document to extendfield
- the field to create the mappings forcms
- the OpenCms context used for building the search indexresource
- 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 resourceprotected I_CmsSearchDocument appendFieldMappings(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
document
- the document to extendcms
- the OpenCms context used for building the search indexresource
- 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 resourceprotected I_CmsSearchDocument appendFileSize(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
document
- the document to extendcms
- the OpenCms context used for building the search indexresource
- 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 resourceprotected I_CmsSearchDocument appendLocales(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extraction, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
document
- the document to extendcms
- the OpenCms context used for building the search indexresource
- the resource that is indexedextraction
- 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 resourceprotected I_CmsSearchDocument appendPath(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
document
- the document to extendcms
- the OpenCms context used for building the search indexresource
- 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 resourceprotected I_CmsSearchDocument appendProperties(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extraction, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
document
- the document to extendcms
- the OpenCms context used for building the search indexresource
- the resource that is indexedextraction
- 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 resourceprotected I_CmsSearchDocument appendType(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched) throws CmsLoaderException
document
- the document to extendcms
- the OpenCms context used for building the search indexresource
- 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 resourceCmsLoaderException
- in case of errors identifying the resource type nameprotected I_CmsSearchDocument setBoost(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
document
- the document to extendcms
- the OpenCms context used for building the search indexresource
- 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