diff --git a/source/java/org/alfresco/repo/search/impl/solr/facet/SolrFacetService.java b/source/java/org/alfresco/repo/search/impl/solr/facet/SolrFacetService.java
index 013274909d..0e2cdb60e3 100644
--- a/source/java/org/alfresco/repo/search/impl/solr/facet/SolrFacetService.java
+++ b/source/java/org/alfresco/repo/search/impl/solr/facet/SolrFacetService.java
@@ -29,6 +29,7 @@ import org.alfresco.repo.search.impl.solr.facet.Exceptions.UnrecognisedFacetId;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
+import org.alfresco.util.Pair;
/**
* Solr Facet service configuration API.
@@ -108,17 +109,17 @@ public interface SolrFacetService
/**
* This method offers a convenient access point for getting all Facetable
* content properties defined in the repository.
- * @return a collection of facetable {@link PropertyDefinition}s.
+ * @return a collection of facetable {@link PropertyDefinition}s, as follows: Pair
.
* @see Facetable
*/
- public Set getFacetableProperties();
+ public Set> getFacetableProperties();
/**
* This method offers a convenient access point for getting all Facetable
* content properties defined on the specified content class (type or aspect).
* @param contentClass the QName of an aspect or type, whose facetable properties are sought.
- * @return a collection of facetable {@link PropertyDefinition}s.
+ * @return a collection of facetable {@link PropertyDefinition}s, as follows: Pair.
* @see Facetable
*/
- public Set getFacetableProperties(QName contentClass);
+ public Set> getFacetableProperties(QName contentClass);
}
diff --git a/source/java/org/alfresco/repo/search/impl/solr/facet/SolrFacetServiceImpl.java b/source/java/org/alfresco/repo/search/impl/solr/facet/SolrFacetServiceImpl.java
index 753baf2f9c..3ba284fb96 100644
--- a/source/java/org/alfresco/repo/search/impl/solr/facet/SolrFacetServiceImpl.java
+++ b/source/java/org/alfresco/repo/search/impl/solr/facet/SolrFacetServiceImpl.java
@@ -66,6 +66,7 @@ import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
+import org.alfresco.util.Pair;
import org.alfresco.util.ParameterCheck;
import org.alfresco.util.collections.CollectionUtils;
import org.apache.commons.logging.Log;
@@ -769,9 +770,9 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
}
}
- @Override public Set getFacetableProperties()
+ @Override public Set> getFacetableProperties()
{
- final Set result = new HashSet<>();
+ final Set> result = new HashSet<>();
final List allContentClasses = CollectionUtils.flatten(dictionaryService.getAllAspects(), dictionaryService.getAllTypes());
@@ -783,9 +784,9 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
return result;
}
- @Override public Set getFacetableProperties(QName contentClass)
+ @Override public Set> getFacetableProperties(QName contentClass)
{
- final Set result = new HashSet<>();
+ final Set> result = new HashSet<>();
final Map propertyDefs = dictionaryService.getPropertyDefs(contentClass);
@@ -798,7 +799,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
switch (propIsFacetable)
{
case TRUE:
- result.add(prop.getValue());
+ result.add(toTitledPropDef(prop.getValue()));
break;
case FALSE:
// The value is not facetable. Do nothing.
@@ -808,7 +809,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
final DataTypeDefinition datatype = prop.getValue().getDataType();
if (isNumeric(datatype) || isDateLike(datatype) || isFacetableText(datatype))
{
- result.add(prop.getValue());
+ result.add(toTitledPropDef(prop.getValue()));
break;
}
break;
@@ -822,6 +823,16 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
return result;
}
+ /**
+ * This method returns a {@link Pair} of the user-displayable property title (if available)
+ * and the {@link PropertyDefinition} itself.
+ */
+ private Pair toTitledPropDef(PropertyDefinition propDef)
+ {
+ String title = propDef.getTitle(dictionaryService);
+ return new Pair<>(title, propDef);
+ }
+
// TODO Consider moving into dictionary code.
private boolean isNumeric(DataTypeDefinition datatype)
{