org.opencms.search.solr
Class CmsSolrFieldConfiguration

java.lang.Object
  extended by org.opencms.search.fields.CmsSearchFieldConfiguration
      extended by org.opencms.search.solr.CmsSolrFieldConfiguration
All Implemented Interfaces:
java.lang.Comparable<CmsSearchFieldConfiguration>

public class CmsSolrFieldConfiguration
extends CmsSearchFieldConfiguration

The search field implementation for Solr.

Since:
8.5.0

Field Summary
 
Fields inherited from class org.opencms.search.fields.CmsSearchFieldConfiguration
STR_STANDARD
 
Constructor Summary
CmsSolrFieldConfiguration()
          Default constructor.
 
Method Summary
protected  void addAdditionalFields(java.util.List<CmsSolrField> additionalFields)
          Adds the additional fields to the configuration, if they are not null.
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 sfield, 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 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 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  java.util.List<java.util.Locale> getContentLocales(CmsObject cms, CmsResource resource, I_CmsExtractionResult extraction)
          Retrieves the locales for an content, that is whether an XML content nor an XML page.
 java.util.Map<java.lang.String,CmsSolrField> getSolrFields()
          Returns all configured Solr fields.
protected  java.util.Set<CmsSearchField> getXSDMappings(CmsObject cms, CmsResource resource)
          Returns the search field mappings declared within the XSD.
 void init()
          Initializes the Solr field configuration.
 
Methods inherited from class org.opencms.search.fields.CmsSearchFieldConfiguration
addField, addFields, appendCategories, appendContentBlob, appendFileSize, appendPath, appendType, compareTo, createDocument, equals, getDescription, getField, getFieldNames, getFields, getIndex, getLocaleExtendedName, getLocaleExtendedName, getName, getParentFolderTokens, hashCode, setBoost, setDescription, setIndex, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsSolrFieldConfiguration

public CmsSolrFieldConfiguration()
Default constructor.

Method Detail

getSolrFields

public java.util.Map<java.lang.String,CmsSolrField> getSolrFields()
Returns all configured Solr fields.

Returns:
all configured Solr fields

init

public void init()
Initializes the Solr field configuration.

Overrides:
init in class CmsSearchFieldConfiguration

addAdditionalFields

protected void addAdditionalFields(java.util.List<CmsSolrField> additionalFields)
Adds the additional fields to the configuration, if they are not null.

Parameters:
additionalFields - the additional fields to add

appendDates

protected I_CmsSearchDocument appendDates(I_CmsSearchDocument document,
                                          CmsObject cms,
                                          CmsResource resource,
                                          I_CmsExtractionResult extractionResult,
                                          java.util.List<CmsProperty> properties,
                                          java.util.List<CmsProperty> propertiesSearched)
Description copied from class: CmsSearchFieldConfiguration
Extends the given document by fields for date of creation, content and last modification.

Overrides:
appendDates in class CmsSearchFieldConfiguration
Parameters:
document - the document to extend
cms - the OpenCms context used for building the search index
resource - the resource that is indexed
extractionResult - the plain text extraction result from the resource
properties - the list of all properties directly attached to the resource (not searched)
propertiesSearched - the list of all searched properties of the resource
Returns:
the document extended by fields for date of creation, content and last modification
See Also:
CmsSearchFieldConfiguration.appendDates(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)

appendFieldMapping

protected I_CmsSearchDocument appendFieldMapping(I_CmsSearchDocument document,
                                                 CmsSearchField sfield,
                                                 CmsObject cms,
                                                 CmsResource resource,
                                                 I_CmsExtractionResult extractionResult,
                                                 java.util.List<CmsProperty> properties,
                                                 java.util.List<CmsProperty> propertiesSearched)
Description copied from class: CmsSearchFieldConfiguration
Extends the given document by the mappings for the given field.

Overrides:
appendFieldMapping in class CmsSearchFieldConfiguration
Parameters:
document - the document to extend
sfield - the field to create the mappings for
cms - the OpenCms context used for building the search index
resource - the resource that is indexed
extractionResult - the plain text extraction result from the resource
properties - the list of all properties directly attached to the resource (not searched)
propertiesSearched - the list of all searched properties of the resource
Returns:
the document extended by the mappings for the given field
See Also:
CmsSearchFieldConfiguration.appendFieldMapping(org.opencms.search.I_CmsSearchDocument, org.opencms.search.fields.CmsSearchField, org.opencms.file.CmsObject, org.opencms.file.CmsResource, org.opencms.search.extractors.I_CmsExtractionResult, java.util.List, java.util.List)

appendFieldMappings

protected I_CmsSearchDocument appendFieldMappings(I_CmsSearchDocument document,
                                                  CmsObject cms,
                                                  CmsResource resource,
                                                  I_CmsExtractionResult extractionResult,
                                                  java.util.List<CmsProperty> properties,
                                                  java.util.List<CmsProperty> propertiesSearched)
Description copied from class: CmsSearchFieldConfiguration
Extends the given document by the configured field mappings.

Overrides:
appendFieldMappings in class CmsSearchFieldConfiguration
Parameters:
document - the document to extend
cms - the OpenCms context used for building the search index
resource - the resource that is indexed
extractionResult - the plain text extraction result from the resource
properties - the list of all properties directly attached to the resource (not searched)
propertiesSearched - the list of all searched properties of the resource
Returns:
the document extended by the configured field mappings
See Also:
CmsSearchFieldConfiguration.appendFieldMappings(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)

appendLocales

protected I_CmsSearchDocument appendLocales(I_CmsSearchDocument document,
                                            CmsObject cms,
                                            CmsResource resource,
                                            I_CmsExtractionResult extraction,
                                            java.util.List<CmsProperty> properties,
                                            java.util.List<CmsProperty> propertiesSearched)
Description copied from class: CmsSearchFieldConfiguration
Extends the given document by the "res_locales" field.

Overrides:
appendLocales in class CmsSearchFieldConfiguration
Parameters:
document - the document to extend
cms - the OpenCms context used for building the search index
resource - the resource that is indexed
extraction - the plain text extraction result from the resource
properties - the list of all properties directly attached to the resource (not searched)
propertiesSearched - the list of all searched properties of the resource
Returns:
the document extended by the resource locales
See Also:
CmsSearchFieldConfiguration.appendLocales(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)

appendProperties

protected I_CmsSearchDocument appendProperties(I_CmsSearchDocument document,
                                               CmsObject cms,
                                               CmsResource resource,
                                               I_CmsExtractionResult extraction,
                                               java.util.List<CmsProperty> properties,
                                               java.util.List<CmsProperty> propertiesSearched)
Description copied from class: CmsSearchFieldConfiguration
Appends all direct properties, that are not empty or white space only to the document.

Overrides:
appendProperties in class CmsSearchFieldConfiguration
Parameters:
document - the document to extend
cms - the OpenCms context used for building the search index
resource - the resource that is indexed
extraction - the plain text extraction result from the resource
properties - the list of all properties directly attached to the resource (not searched)
propertiesSearched - the list of all searched properties of the resource
Returns:
the document extended by resource category information
See Also:
CmsSearchFieldConfiguration.appendProperties(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)

getContentLocales

protected java.util.List<java.util.Locale> getContentLocales(CmsObject cms,
                                                             CmsResource resource,
                                                             I_CmsExtractionResult extraction)
Retrieves the locales for an content, that is whether an XML content nor an XML page.

Uses following strategy:

Parameters:
cms - the current CmsObject
resource - the resource to get the content locales for
extraction - the extraction result
Returns:
the determined locales for the given resource

getXSDMappings

protected java.util.Set<CmsSearchField> getXSDMappings(CmsObject cms,
                                                       CmsResource resource)
Returns the search field mappings declared within the XSD.

Parameters:
cms - the CmsObject
resource - the resource
Returns:
the fields to map