org.opencms.search.documents
Class CmsDocumentXmlContent

java.lang.Object
  extended by org.opencms.search.documents.A_CmsVfsDocument
      extended by org.opencms.search.documents.CmsDocumentXmlContent
All Implemented Interfaces:
I_CmsDocumentFactory, I_CmsSearchExtractor

public class CmsDocumentXmlContent
extends A_CmsVfsDocument

Lucene document factory class to extract index data from an OpenCms VFS resource of type 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 have the form like for example Text[1] or Nested[1]/Text[1].

Since:
6.0.0
Version:
$Revision: 1.17 $
Author:
Alexander Kandzior, Carsten Weinholz

Field Summary
 
Fields inherited from class org.opencms.search.documents.A_CmsVfsDocument
m_name, SEARCH_PRIORITY_HIGH_VALUE, SEARCH_PRIORITY_LOW_VALUE, SEARCH_PRIORITY_MAX_VALUE, SEARCH_PRIORITY_NORMAL_VALUE, VFS_DOCUMENT_KEY_PREFIX
 
Constructor Summary
CmsDocumentXmlContent(java.lang.String name)
          Creates a new instance of this lucene document factory.
 
Method Summary
 I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, CmsSearchIndex index)
          Returns the raw text content of a given VFS resource of type CmsResourceTypeXmlContent.
 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()
          Returns true if this document factory is locale depended.
 boolean isUsingCache()
          Returns true if result caching is supported for this factory.
 
Methods inherited from class org.opencms.search.documents.A_CmsVfsDocument
createDocument, getCache, getDocumentKey, getName, readFile, setCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsDocumentXmlContent

public CmsDocumentXmlContent(java.lang.String name)
Creates a new instance of this lucene document factory.

Parameters:
name - name of the document type
Method Detail

extractContent

public I_CmsExtractionResult extractContent(CmsObject cms,
                                            CmsResource resource,
                                            CmsSearchIndex index)
                                     throws CmsException
Returns the raw text content of a given VFS resource of type 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 have the form like for example Text[1] or Nested[1]/Text[1].

Parameters:
cms - the cms object
resource - the resource to extract the content from
index - the index to extract the content for
Returns:
the extracted content of the resource
Throws:
CmsException - if somethin goes wrong
See Also:
I_CmsSearchExtractor.extractContent(CmsObject, CmsResource, 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 corrospondig I_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 interface I_CmsDocumentFactory
Overrides:
getDocumentKeys in class A_CmsVfsDocument
Parameters:
resourceTypes - list of accepted resource types
mimeTypes - 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()
Description copied from interface: I_CmsDocumentFactory
Returns true if this document factory is locale depended.

Returns:
true if this document factory is locale depended
See Also:
I_CmsDocumentFactory.isLocaleDependend()

isUsingCache

public boolean isUsingCache()
Description copied from interface: I_CmsDocumentFactory
Returns true if result caching is supported for this factory.

Returns:
true if result caching is supported for this factory
See Also:
I_CmsDocumentFactory.isUsingCache()