mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
If PartialSolrInputDocument, merge the multiple localised values in a single array instead of doing an array of arrays which is unsupported
This commit is contained in:
+15
-4
@@ -2321,14 +2321,24 @@ public class SolrInformationServer implements InformationServer
|
||||
}
|
||||
}
|
||||
|
||||
void mltextProperty(QName propertyQName, MLTextPropertyValue value, final BiConsumer<String, Object> valueHolder)
|
||||
void mltextProperty(QName propertyQName, MLTextPropertyValue value, final BiConsumer<String, Object> valueHolder, boolean merge)
|
||||
{
|
||||
AlfrescoSolrDataModel dataModel = AlfrescoSolrDataModel.getInstance();
|
||||
List<FieldInstance> fields = dataModel.getIndexedFieldNamesForProperty(propertyQName).getFields();
|
||||
|
||||
String storedFieldName = dataModel.getStoredMLTextField(propertyQName);
|
||||
|
||||
valueHolder.accept(storedFieldName, getLocalisedValues(value));
|
||||
List<String> localisedValues = getLocalisedValues(value);
|
||||
|
||||
if (merge)
|
||||
{
|
||||
localisedValues.forEach(val -> valueHolder.accept(storedFieldName, val));
|
||||
}
|
||||
else
|
||||
{
|
||||
valueHolder.accept(storedFieldName, localisedValues);
|
||||
}
|
||||
|
||||
fields.stream()
|
||||
.filter(FieldInstance::isSort)
|
||||
.forEach(field -> addMLTextProperty(valueHolder, field, value));
|
||||
@@ -2406,7 +2416,7 @@ public class SolrInformationServer implements InformationServer
|
||||
}
|
||||
else if (value instanceof MLTextPropertyValue)
|
||||
{
|
||||
mltextProperty(propertyQName,(MLTextPropertyValue) value, setAndCollect);
|
||||
mltextProperty(propertyQName,(MLTextPropertyValue) value, setAndCollect, false);
|
||||
}
|
||||
else if (value instanceof ContentPropertyValue)
|
||||
{
|
||||
@@ -2431,7 +2441,8 @@ public class SolrInformationServer implements InformationServer
|
||||
}
|
||||
else if (singleValue instanceof MLTextPropertyValue)
|
||||
{
|
||||
mltextProperty(propertyQName,(MLTextPropertyValue) singleValue, addAndCollect);
|
||||
boolean merge = (document instanceof PartialSolrInputDocument);
|
||||
mltextProperty(propertyQName,(MLTextPropertyValue) singleValue, addAndCollect, merge);
|
||||
}
|
||||
else if (singleValue instanceof ContentPropertyValue)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user