Package org.opencms.search.solr
Class CmsSolrDocumentXmlContent
- java.lang.Object
-
- org.opencms.search.documents.A_CmsVfsDocument
-
- org.opencms.search.solr.CmsSolrDocumentXmlContent
-
- All Implemented Interfaces:
I_CmsDocumentFactory
,I_CmsSearchExtractor
- Direct Known Subclasses:
CmsSolrDocumentContainerPage
public class CmsSolrDocumentXmlContent extends A_CmsVfsDocument
Special document text extraction factory for Solr index.- Since:
- 8.5.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MAPPING_GALLERY_DESCRIPTION
Mapping name used to indicate that the value should be used for the gallery description.static java.lang.String
MAPPING_GALLERY_NAME
Mapping name used to indicate that the value should be used for the gallery name.static java.lang.String
TYPE_XMLCONTENT_SOLR
The solr document type name for xml-contents.-
Fields inherited from class org.opencms.search.documents.A_CmsVfsDocument
m_name
-
-
Constructor Summary
Constructors Constructor Description CmsSolrDocumentXmlContent(java.lang.String name)
Public constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
collectSchemaXpathsForSimpleValues(CmsObject cms, CmsXmlContentDefinition def, java.lang.String path, java.util.Set<java.lang.String> result)
Collects a list of all possible XPaths for a content definition.I_CmsExtractionResult
extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
Extracts the content of a given index resource according to the resource file type and the configuration of the given index.static CmsExtractionResult
extractXmlContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
Extracts the content of a single XML content resource.static CmsExtractionResult
extractXmlContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index, java.util.Locale forceLocale)
Extracts the content of a single XML content resource.static CmsExtractionResult
extractXmlContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index, java.util.Locale forceLocale, java.util.Set<CmsUUID> alreadyExtracted)
Extracts the content of a single XML content resource.java.util.List<java.lang.String>
getDocumentKeys(java.util.List<java.lang.String> resourceTypes, java.util.List<java.lang.String> mimeTypes)
Returns the list of accepted keys for the resource types that can be indexed using this document factory.boolean
isLocaleDependend()
Solr index content is stored in multiple languages, so the result is NOT locale dependent.boolean
isUsingCache()
Returnstrue
if result caching is supported for this factory.-
Methods inherited from class org.opencms.search.documents.A_CmsVfsDocument
createDocument, getCache, getDocumentKey, getName, logContentExtraction, readFile, setCache
-
-
-
-
Field Detail
-
MAPPING_GALLERY_DESCRIPTION
public static final java.lang.String MAPPING_GALLERY_DESCRIPTION
Mapping name used to indicate that the value should be used for the gallery description.- See Also:
- Constant Field Values
-
MAPPING_GALLERY_NAME
public static final java.lang.String MAPPING_GALLERY_NAME
Mapping name used to indicate that the value should be used for the gallery name.- See Also:
- Constant Field Values
-
TYPE_XMLCONTENT_SOLR
public static final java.lang.String TYPE_XMLCONTENT_SOLR
The solr document type name for xml-contents.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsSolrDocumentXmlContent
public CmsSolrDocumentXmlContent(java.lang.String name)
Public constructor.- Parameters:
name
- the name for the document type
-
-
Method Detail
-
collectSchemaXpathsForSimpleValues
public static void collectSchemaXpathsForSimpleValues(CmsObject cms, CmsXmlContentDefinition def, java.lang.String path, java.util.Set<java.lang.String> result)
Collects a list of all possible XPaths for a content definition.- Parameters:
cms
- the CMS context to usedef
- the content definitionpath
- the path of the given content definitionresult
- the set used to collect the XPaths
-
extractXmlContent
public static CmsExtractionResult extractXmlContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsException
Extracts the content of a single XML content resource.- Parameters:
cms
- the cms contextresource
- the resourceindex
- the used index- Returns:
- the extraction result
- Throws:
CmsException
- in case reading or unmarshalling the content fails
-
extractXmlContent
public static CmsExtractionResult extractXmlContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index, java.util.Locale forceLocale) throws CmsException
Extracts the content of a single XML content resource.- Parameters:
cms
- the cms contextresource
- the resourceindex
- the used indexforceLocale
- if set, only the content values for the given locale will be extracted- Returns:
- the extraction result
- Throws:
CmsException
- in case reading or unmarshalling the content fails
-
extractXmlContent
public static CmsExtractionResult extractXmlContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index, java.util.Locale forceLocale, java.util.Set<CmsUUID> alreadyExtracted) throws CmsException
Extracts the content of a single XML content resource.- Parameters:
cms
- the cms contextresource
- the resourceindex
- the used indexforceLocale
- if set, only the content values for the given locale will be extracted- Returns:
- the extraction result
- Throws:
CmsException
- in case reading or unmarshalling the content fails
-
extractContent
public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsException
Description copied from interface:I_CmsSearchExtractor
Extracts the content of a given index resource according to the resource file type and the configuration of the given index.- Parameters:
cms
- the cms objectresource
- the resource to extract the content fromindex
- the index to extract the content for- Returns:
- the extracted content of the resource
- Throws:
CmsException
- if something goes wrong- See Also:
CmsDocumentXmlContent.extractContent(org.opencms.file.CmsObject, org.opencms.file.CmsResource, org.opencms.search.I_CmsSearchIndex)
-
getDocumentKeys
public java.util.List<java.lang.String> getDocumentKeys(java.util.List<java.lang.String> resourceTypes, java.util.List<java.lang.String> mimeTypes) throws CmsException
Description copied from interface:I_CmsDocumentFactory
Returns the list of accepted keys for the resource types that can be indexed using this document factory.The result List contains String objects. This String is later matched against
A_CmsVfsDocument.getDocumentKey(String, String)
to find the corrospondigI_CmsDocumentFactory
for a resource to index.The list of accepted resource types may contain a catch-all entry "*"; in this case, a list for all possible resource types is returned, calculated by a logic depending on the document handler class.
- Specified by:
getDocumentKeys
in interfaceI_CmsDocumentFactory
- Overrides:
getDocumentKeys
in classA_CmsVfsDocument
- Parameters:
resourceTypes
- list of accepted resource typesmimeTypes
- list of accepted mime types- Returns:
- the list of accepted keys for the resource types that can be indexed using this document factory (String objects)
- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsDocumentFactory.getDocumentKeys(java.util.List, java.util.List)
-
isLocaleDependend
public boolean isLocaleDependend()
Solr index content is stored in multiple languages, so the result is NOT locale dependent.- Returns:
true
if this document factory is locale depended- See Also:
I_CmsDocumentFactory.isLocaleDependend()
-
isUsingCache
public boolean isUsingCache()
Description copied from interface:I_CmsDocumentFactory
Returnstrue
if result caching is supported for this factory.- Returns:
true
if result caching is supported for this factory- See Also:
I_CmsDocumentFactory.isUsingCache()
-
-