*/
@Override
protected void addStringValue(Document doc, String fieldName, Object internalValue,
boolean tokenized, boolean includeInNodeIndex, float boost, boolean useInExcerpt) {
ExtendedPropertyDefinition definition = getExtendedPropertyDefinition(nodeType, node, getPropertyNameFromFieldname(fieldName));
if (definition != null && SelectorType.RICHTEXT == definition.getSelector()) {
try {
Metadata metadata = new Metadata();
metadata.set(Metadata.CONTENT_TYPE, "text/html");
metadata.set(Metadata.CONTENT_ENCODING, InternalValueFactory.DEFAULT_ENCODING);
TextExtractionService textExtractor = (TextExtractionService) SpringContextSingleton.getBean("org.jahia.services.textextraction.TextExtractionService");
internalValue = textExtractor.parse(new ByteArrayInputStream(((String) internalValue)
.getBytes(InternalValueFactory.DEFAULT_ENCODING)), metadata);
} catch (Exception e) {
internalValue = StringEscapeUtils.unescapeHtml((String) internalValue);
}
}
super.addStringValue(doc, fieldName, internalValue, tokenized, includeInNodeIndex, boost,
useInExcerpt);
if (tokenized) {
String stringValue = (String) internalValue;
if (stringValue.length() == 0) {
return;
}
if (includeInNodeIndex && isSupportSpellchecking()) {
String site = resolveSite();
String language = resolveLanguage();
StringBuilder fulltextNameBuilder = new StringBuilder(FieldNames.FULLTEXT);
if (site != null) {
fulltextNameBuilder.append("-").append(site);
}
if (language != null) {
fulltextNameBuilder.append("-").append(language);
}
String fulltextName = fulltextNameBuilder.toString();
if (!FieldNames.FULLTEXT.equals(fulltextName)) {
doc.add(createFulltextField(fulltextName, stringValue, false));
}
}
}
if (definition != null && definition.isFacetable()) {
addFacetValue(doc, fieldName, internalValue);
}
}