/** * Returns a lucene document factory for given resource type and MIME type.<p> * * The type of the document factory is selected according to the configuration * in <code>opencms-search.xml</code>.<p> * * @param resourceType the resource type name * @param mimeType the MIME type * * @return a lucene document factory or null in case no matching factory was found */ public I_CmsDocumentFactory getDocumentFactory(String resourceType, String mimeType) { I_CmsDocumentFactory result = null; if (resourceType != null) { // create the factory lookup key for the document String documentTypeKey = A_CmsVfsDocument.getDocumentKey(resourceType, mimeType); // check if a setting is available for this specific MIME type result = m_documentTypes.get(documentTypeKey); if (result == null) { // no setting is available, try to use a generic setting without MIME type result = m_documentTypes.get(A_CmsVfsDocument.getDocumentKey(resourceType, null)); // please note: the result may still be null } } return result; }
/** * @see org.opencms.search.documents.I_CmsDocumentFactory#getDocumentKeys(java.util.List, java.util.List) */ @Override public List<String> getDocumentKeys(List<String> resourceTypes, List<String> mimeTypes) throws CmsException { if (resourceTypes.contains("*")) { // we need to find all configured XML content types List<String> allTypes = new ArrayList<String>(); for (Iterator<I_CmsResourceType> i = OpenCms.getResourceManager().getResourceTypes().iterator(); i.hasNext();) { I_CmsResourceType resourceType = i.next(); if ((resourceType instanceof CmsResourceTypeXmlContent) // either we need a configured schema, or another class name (which must then contain an inline schema) && (((CmsResourceTypeXmlContent)resourceType).getConfiguration().containsKey( CmsResourceTypeXmlContent.CONFIGURATION_SCHEMA) || !CmsResourceTypeXmlContent.class.equals(resourceType.getClass()))) { // add the XML content resource type name allTypes.add(resourceType.getTypeName()); } } resourceTypes = allTypes; } return super.getDocumentKeys(resourceTypes, mimeTypes); }
CmsExtractionResultCache cache = getCache(); String cacheName = null; if ((cache != null) && (resource.getSiblingCount() > 1)) { isLocaleDependend() ? index.getLocaleForResource(cms, resource, null) : null, getName()); content = cache.getCacheObject(cacheName); content = extractContent(cms, resource, index); if (LOG.isDebugEnabled()) { LOG.debug("Extracting content for '" + resource.getRootPath() + "' successful.");
CmsExtractionResultCache cache = getCache(); String cacheName = null; if ((cache != null) && (resource.getSiblingCount() > 1)) { cacheName = cache.getCacheName(resource, isLocaleDependend() ? index.getLocale() : null); content = cache.getCacheObject(cacheName); content = extractContent(cms, resource, index); if ((cache != null) && (resource.getSiblingCount() > 1)) {
/** * * @see org.opencms.search.documents.A_CmsVfsDocument#createDocument(org.opencms.file.CmsObject, org.opencms.file.CmsResource, org.opencms.search.CmsSearchIndex) */ @Override public I_CmsSearchDocument createDocument(CmsObject cms, CmsResource resource, CmsSearchIndex index) throws CmsException { CmsXmlContentDefinition def = CmsXmlContentDefinition.getContentDefinitionForResource(cms, resource); if (def.getContentHandler().isContainerPageOnly()) { return null; } return super.createDocument(cms, resource, index); }
/** * @see org.opencms.search.documents.I_CmsDocumentFactory#getDocumentKeys(java.util.List, java.util.List) */ public List<String> getDocumentKeys(List<String> resourceTypes, List<String> mimeTypes) throws CmsException { List<String> keys = new ArrayList<String>(); if (resourceTypes.contains("*")) { List<String> allTypes = new ArrayList<String>(); for (Iterator<I_CmsResourceType> i = OpenCms.getResourceManager().getResourceTypes().iterator(); i.hasNext();) { I_CmsResourceType resourceType = i.next(); allTypes.add(resourceType.getTypeName()); } resourceTypes = allTypes; } try { for (Iterator<String> i = resourceTypes.iterator(); i.hasNext();) { String typeName = i.next(); for (Iterator<String> j = mimeTypes.iterator(); j.hasNext();) { keys.add(getDocumentKey(typeName, j.next())); } if (mimeTypes.isEmpty()) { keys.add(getDocumentKey(typeName, null)); } } } catch (Exception exc) { throw new CmsException(Messages.get().container(Messages.ERR_CREATE_DOC_KEY_0), exc); } return keys; }
/** * @see org.opencms.search.documents.I_CmsDocumentFactory#getDocumentKeys(java.util.List, java.util.List) */ @Override public List<String> getDocumentKeys(List<String> resourceTypes, List<String> mimeTypes) throws CmsException { if (resourceTypes.contains("*")) { // we need to find all configured XML content types List<String> allTypes = new ArrayList<String>(); for (Iterator<I_CmsResourceType> i = OpenCms.getResourceManager().getResourceTypes().iterator(); i.hasNext();) { I_CmsResourceType resourceType = i.next(); if ((resourceType instanceof CmsResourceTypeXmlContent) // either we need a configured schema, or another class name (which must then contain an inline schema) && (((CmsResourceTypeXmlContent)resourceType).getConfiguration().containsKey( CmsResourceTypeXmlContent.CONFIGURATION_SCHEMA) || !CmsResourceTypeXmlContent.class.equals(resourceType.getClass()))) { // add the XML content resource type name allTypes.add(resourceType.getTypeName()); } } resourceTypes = allTypes; } return super.getDocumentKeys(resourceTypes, mimeTypes); }
/** * @see org.opencms.search.documents.I_CmsDocumentFactory#getDocumentKeys(java.util.List, java.util.List) */ public List<String> getDocumentKeys(List<String> resourceTypes, List<String> mimeTypes) throws CmsException { List<String> keys = new ArrayList<String>(); if (resourceTypes.contains("*")) { List<String> allTypes = new ArrayList<String>(); for (Iterator<I_CmsResourceType> i = OpenCms.getResourceManager().getResourceTypes().iterator(); i.hasNext();) { I_CmsResourceType resourceType = i.next(); allTypes.add(resourceType.getTypeName()); } resourceTypes = allTypes; } try { for (Iterator<String> i = resourceTypes.iterator(); i.hasNext();) { String typeName = OpenCms.getResourceManager().getResourceType(i.next()).getTypeName(); for (Iterator<String> j = mimeTypes.iterator(); j.hasNext();) { keys.add(getDocumentKey(typeName, j.next())); } if (mimeTypes.isEmpty()) { keys.add(getDocumentKey(typeName, null)); } } } catch (Exception exc) { throw new CmsException(Messages.get().container(Messages.ERR_CREATE_DOC_KEY_0), exc); } return keys; }
/** * @see org.opencms.search.documents.I_CmsDocumentFactory#getDocumentKeys(java.util.List, java.util.List) */ @Override public List<String> getDocumentKeys(List<String> resourceTypes, List<String> mimeTypes) throws CmsException { if (resourceTypes.contains("*")) { // we need to find all configured XML content types List<String> allTypes = new ArrayList<String>(); for (Iterator<I_CmsResourceType> i = OpenCms.getResourceManager().getResourceTypes().iterator(); i.hasNext();) { I_CmsResourceType resourceType = i.next(); if ((resourceType instanceof CmsResourceTypeXmlContent) // either we need a configured schema, or another class name (which must then contain an inline schema) && (((CmsResourceTypeXmlContent)resourceType).getConfiguration().containsKey( CmsResourceTypeXmlContent.CONFIGURATION_SCHEMA) || !CmsResourceTypeXmlContent.class.equals(resourceType.getClass()))) { // add the XML content resource type name allTypes.add(resourceType.getTypeName()); } } resourceTypes = allTypes; } return super.getDocumentKeys(resourceTypes, mimeTypes); }
String documentTypeKey = A_CmsVfsDocument.getDocumentKey(typeName, mimeType); result = m_documentTypes.get(A_CmsVfsDocument.getDocumentKey(typeName, null));