public class CmsSearchFieldConfiguration extends A_CmsSearchFieldConfiguration
| Modifier and Type | Field and Description |
|---|---|
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.
|
| Constructor and Description |
|---|
CmsSearchFieldConfiguration()
Creates a new, empty field configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addUninvertingMappings(java.util.Map<java.lang.String,org.apache.solr.uninverting.UninvertingReader.Type> uninvertingMap)
To allow sorting on a field the field must be added to the map given to
UninvertingReader.wrap(org.apache.lucene.index.DirectoryReader, Map). |
protected I_CmsSearchDocument |
appendAdditionalValuesToDcoument(I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
I_CmsExtractionResult extraction,
java.util.List<CmsProperty> properties,
java.util.List<CmsProperty> propertiesSearched)
Overriding this method allows to append some 'extra' values/fields to a document
without overriding the
createDocument(org.opencms.file.CmsObject, org.opencms.file.CmsResource, org.opencms.search.I_CmsSearchIndex, org.opencms.search.extractors.I_CmsExtractionResult) method itself. |
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.
|
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.
|
I_CmsSearchDocument |
createDocument(CmsObject cms,
CmsResource resource,
I_CmsSearchIndex index,
I_CmsExtractionResult extraction)
Creates the Lucene Document with this field configuration for the provided VFS resource, search index and content.
|
I_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.
|
static java.lang.String |
getParentFolderTokens(java.lang.String rootPath)
Creates a space separated list of all parent folders of the given root path.
|
void |
setIndex(CmsSearchIndex index)
Sets the index.
|
addField, compareTo, equals, getDescription, getField, getFieldNames, getFields, getName, hashCode, init, setDescription, setNamepublic 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 addUninvertingMappings(java.util.Map<java.lang.String,org.apache.solr.uninverting.UninvertingReader.Type> uninvertingMap)
UninvertingReader.wrap(org.apache.lucene.index.DirectoryReader, Map).
The method adds the configured fields.addUninvertingMappings in interface I_CmsSearchFieldConfigurationaddUninvertingMappings in class A_CmsSearchFieldConfigurationuninvertingMap - the map to which the fields are added.I_CmsSearchFieldConfiguration.addUninvertingMappings(java.util.Map)public I_CmsSearchDocument createDocument(CmsObject cms, CmsResource resource, I_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 I_CmsSearchIndex getIndex()
public void setIndex(CmsSearchIndex index)
index - the index to setprotected I_CmsSearchDocument appendAdditionalValuesToDcoument(I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extraction, java.util.List<CmsProperty> properties, java.util.List<CmsProperty> propertiesSearched)
createDocument(org.opencms.file.CmsObject, org.opencms.file.CmsResource, org.opencms.search.I_CmsSearchIndex, org.opencms.search.extractors.I_CmsExtractionResult) method itself.
The method createDocument(org.opencms.file.CmsObject, org.opencms.file.CmsResource, org.opencms.search.I_CmsSearchIndex, org.opencms.search.extractors.I_CmsExtractionResult) reads all properties of the current resource which is
an expensive operation. In order to avoid reading those properties twice, this method has been introduced.
Compared with all the other appender methods the name of this method is generic.
In this default implementation the document is returned unchanged.
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 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 name