Merged 5.2.N (5.2.1) to HEAD (5.2)

131769 ahind: Fix for SEARCH-222    SOLR 6 - Improved indexing for categories
   - return ancestor based path for better support to internationalise categories etc (by UUID matching the public AIP)


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@132297 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-11-03 13:57:49 +00:00
parent 7d606bd6eb
commit 9cfd6462f1

View File

@@ -274,21 +274,27 @@ public class NodesMetaDataGet extends DeclarativeWebScript
this.txnId = nodeMetaData.getTxnId(); this.txnId = nodeMetaData.getTxnId();
// convert Paths to Strings // convert Paths to Strings
List<String> paths = new ArrayList<String>(); List<String> paths = new ArrayList<String>();
List<String> ancestorPaths = new ArrayList<String>();
HashSet<String> ancestors = new HashSet<String>(); HashSet<String> ancestors = new HashSet<String>();
if(nodeMetaData.getPaths() != null) if(nodeMetaData.getPaths() != null)
{ {
StringBuilder ancestorPath = new StringBuilder();
for(Pair<Path, QName> pair : nodeMetaData.getPaths()) for(Pair<Path, QName> pair : nodeMetaData.getPaths())
{ {
JSONObject o = new JSONObject(); JSONObject o = new JSONObject();
o.put("path", solrSerializer.serializeValue(String.class, pair.getFirst())); o.put("path", solrSerializer.serializeValue(String.class, pair.getFirst()));
o.put("qname", solrSerializer.serializeValue(String.class, pair.getSecond())); o.put("qname", solrSerializer.serializeValue(String.class, pair.getSecond()));
paths.add(o.toString(3));
for (NodeRef ancestor : getAncestors(pair.getFirst())) for (NodeRef ancestor : getAncestors(pair.getFirst()))
{ {
ancestors.add(ancestor.toString()); ancestors.add(ancestor.toString());
} ancestorPath.insert(0, ancestor.getId()).insert(0, "/");
}
o.put("apath", ancestorPath);
paths.add(o.toString(3));
} }
} }
this.ancestors = ancestors; this.ancestors = ancestors;