public class CmsGalleryDocumentXmlContent extends CmsDocumentXmlContent
m_name
构造器和说明 |
---|
CmsGalleryDocumentXmlContent(java.lang.String name)
Creates a new instance of this Lucene document factory.
|
限定符和类型 | 方法和说明 |
---|---|
I_CmsSearchDocument |
createDocument(CmsObject cms,
CmsResource resource,
CmsSearchIndex index)
Generates a new lucene document instance from contents of the given resource for the provided index.
|
I_CmsExtractionResult |
extractContent(CmsObject cms,
CmsResource resource,
CmsSearchIndex index)
Returns the raw text content of a given VFS resource of type
CmsResourceTypeXmlContent . |
protected java.util.List<java.util.Locale> |
getLocalesToStore(A_CmsXmlDocument content)
Gets the locales which should be stored in the locale field of the document for the given content.
|
protected java.util.List<java.util.Locale> |
getTargetLocalesForField(A_CmsXmlDocument xmlContent,
java.lang.String fieldName,
java.util.Locale sourceLocale)
Returns the locales which the given field should be written to in the document.
|
protected boolean |
isGroup(A_CmsXmlDocument content)
Helper method to check whether the content is an element group.
|
boolean |
isLocaleDependend()
Gallery index content is stored in multiple languages, so the result is NOT locale dependent.
|
protected void |
putMappingValue(A_CmsXmlDocument xmlContent,
java.lang.String fieldName,
java.util.Locale sourceLocale,
java.util.Map<java.lang.String,java.lang.String> items,
java.lang.String value)
Adds the given value to the document items for all target locales.
|
getDocumentKeys, isUsingCache
getCache, getDocumentKey, getName, logContentExtraction, readFile, setCache
public CmsGalleryDocumentXmlContent(java.lang.String name)
name
- name of the document typepublic I_CmsSearchDocument createDocument(CmsObject cms, CmsResource resource, CmsSearchIndex index) throws CmsException
For gallery document generators, we never check for CmsSearchIndex.isExtractingContent()
since
all these classes are assumed to be written with optimizations special to gallery search indexing anyway.
createDocument
在接口中 I_CmsDocumentFactory
createDocument
在类中 CmsDocumentXmlContent
cms
- the OpenCms user context used to access the OpenCms VFSresource
- the search index resource to create the Lucene document fromindex
- the search index to create the Document forCmsException
- if something goes wrongCmsSearchFieldConfiguration.createDocument(CmsObject, CmsResource, CmsSearchIndex, I_CmsExtractionResult)
,
I_CmsDocumentFactory.createDocument(CmsObject, CmsResource, CmsSearchIndex)
public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, CmsSearchIndex index) throws CmsException
CmsResourceTypeXmlContent
.
All XML nodes from the content for all locales will be stored separately in the item map
which you can access using CmsExtractionResult.getContentItems()
. The XML elements will be
accessible using their xpath. The xpath will start with the locale and have the form like for example
de/Text[1]
or en/Nested[1]/Text[1]
.
extractContent
在接口中 I_CmsSearchExtractor
extractContent
在类中 CmsDocumentXmlContent
cms
- the cms objectresource
- the resource to extract the content fromindex
- the index to extract the content forCmsException
- if something goes wrongI_CmsSearchExtractor.extractContent(CmsObject, CmsResource, CmsSearchIndex)
public boolean isLocaleDependend()
isLocaleDependend
在接口中 I_CmsDocumentFactory
isLocaleDependend
在类中 CmsDocumentXmlContent
true
if this document factory is locale dependedCmsDocumentXmlContent.isLocaleDependend()
protected java.util.List<java.util.Locale> getLocalesToStore(A_CmsXmlDocument content)
content
- the XML contentprotected java.util.List<java.util.Locale> getTargetLocalesForField(A_CmsXmlDocument xmlContent, java.lang.String fieldName, java.util.Locale sourceLocale)
xmlContent
- the XML contentfieldName
- the field namesourceLocale
- the source localeprotected boolean isGroup(A_CmsXmlDocument content)
content
- the content to checkprotected void putMappingValue(A_CmsXmlDocument xmlContent, java.lang.String fieldName, java.util.Locale sourceLocale, java.util.Map<java.lang.String,java.lang.String> items, java.lang.String value)
xmlContent
- the XML contentfieldName
- the field namesourceLocale
- the source localeitems
- the document itemsvalue
- the value to put