/** * Serializes the given extraction result and saves it in the disk cache.<p> * * @param rfsName the RFS name of the file to save the extraction result in * @param content the extraction result to serialize and save * * @throws IOException in case of disk access errors */ public void saveCacheObject(String rfsName, I_CmsExtractionResult content) throws IOException { byte[] byteContent = content.getBytes(); if (byteContent != null) { CmsVfsDiskCache.saveFile(rfsName, byteContent); } } }
/** * @see org.opencms.search.extractors.I_CmsExtractionResult#merge(java.util.List) */ public I_CmsExtractionResult merge(List<I_CmsExtractionResult> extractionResults) { //prepare copy Map<Locale, LinkedHashMap<String, String>> contentItems = new HashMap<Locale, LinkedHashMap<String, String>>( m_locales.size()); for (Locale locale : m_locales) { LinkedHashMap<String, String> originalLocalValues = m_contentItems.get(locale); LinkedHashMap<String, String> localeValues = new LinkedHashMap<String, String>(originalLocalValues); contentItems.put(locale, localeValues); } HashMap<String, String> fieldMappings = new HashMap<String, String>(m_fieldMappings.size()); for (String fieldMapping : m_fieldMappings.keySet()) { fieldMappings.put(fieldMapping, m_fieldMappings.get(fieldMapping)); } //merge content from the other extraction results for (Locale locale : m_locales) { Map<String, String> localeValues = contentItems.get(locale); for (I_CmsExtractionResult result : extractionResults) { if (result.getLocales().contains(locale)) { Map<String, String> resultLocaleValues = result.getContentItems(locale); for (String item : Arrays.asList(ITEMS_TO_MERGE)) { localeValues = mergeItem(item, localeValues, resultLocaleValues); } } } } return new CmsExtractionResult(m_defaultLocale, contentItems, fieldMappings); }
case 0: // content if (extractionResult != null) { content = extractionResult.getContent(); case 3: // item if ((extractionResult != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(getParam())) { content = extractionResult.getContentItems().get(getParam());
&& (detectedLocale == null) && (extraction != null) && (extraction.getContent() != null)) { detectedLocale = CmsStringUtil.getLocaleForText(extraction.getContent());
locale); containersExtractionResult.getContentItems().remove(CmsSearchField.FIELD_RESOURCE_LOCALES); result = result.merge(ex); return result;
Map<String, String> fieldMappings = extractionResult.getFieldMappings(); for (String fieldName : fieldMappings.keySet()) { String value = fieldMappings.get(fieldName);
if ((extraction != null) && (!extraction.getLocales().isEmpty())) { resourceLocales = extraction.getLocales(); boolean isGroup = false; for (String groupType : Arrays.asList(
: index.getLocaleForResource(cms, resource, containerPage.getLocales()); ex = new CmsExtractionResult(locale, multilingualValues, fieldMappings); ex = ex.merge(all); return ex; } catch (Exception e) {
case 0: // content if (extractionResult != null) { content = extractionResult.getContent(); if (paramParts.length > 1) { OpenCms.getLocaleManager(); localizedContentItems = extractionResult.getContentItems( CmsLocaleManager.getLocale(paramParts[0].trim())); xpath = paramParts[1].trim(); } else { localizedContentItems = extractionResult.getContentItems(); xpath = paramParts[0].trim();
if ((field.getLocale() != null) && mapping.getType().equals(CmsSearchFieldMappingType.CONTENT)) { mapResult = extractionResult.getContent(field.getLocale()); if (mapResult == null) { mapResult = extractionResult.getContent();
try { originalSource = textExtractor.extractText(content1).getContent(); copySource = textExtractor.extractText(content2).getContent(); } catch (Exception e) {
/** * Serializes the given extraction result and saves it in the disk cache.<p> * * @param rfsName the RFS name of the file to save the extraction result in * @param content the extraction result to serialize and save * * @throws IOException in case of disk access errors */ public void saveCacheObject(String rfsName, I_CmsExtractionResult content) throws IOException { byte[] byteContent = content.getBytes(); if (byteContent != null) { CmsVfsDiskCache.saveFile(rfsName, byteContent); } } }
originalSource = textExtractor.extractText(content1).getContent(); copySource = textExtractor.extractText(content2).getContent(); } else if ((resourceType instanceof CmsResourceTypePlain) || (resourceType instanceof CmsResourceTypeJsp)) { originalSource = new String(content1);
/** * Extends the given document by a field that contains the extracted content blob.<p> * * @param document the document to extend * @param cms the OpenCms context used for building the search index * @param resource the resource that is indexed * @param extractionResult the plain text extraction result from the resource * @param properties the list of all properties directly attached to the resource (not searched) * @param propertiesSearched the list of all searched properties of the resource * * @return the document extended by a field that contains the extracted content blob */ protected I_CmsSearchDocument appendContentBlob( I_CmsSearchDocument document, CmsObject cms, CmsResource resource, I_CmsExtractionResult extractionResult, List<CmsProperty> properties, List<CmsProperty> propertiesSearched) { if (extractionResult != null) { byte[] data = extractionResult.getBytes(); if (data != null) { document.addContentField(data); } } return document; }
try { originalSource = textExtractor.extractText(content1).getContent(); copySource = textExtractor.extractText(content2).getContent(); } catch (Exception e) {
byte[] data = content.getBytes(); if (data != null) { Fieldable field = new Field(CmsSearchField.FIELD_CONTENT_BLOB, data, Field.Store.COMPRESS);