/** * @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); }