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/BRANCHES/DEV/5.2.N/root@131769 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2016-10-26 08:51:01 +00:00
parent 723d380c3b
commit 3110968b5b

View File

@@ -274,21 +274,27 @@ public class NodesMetaDataGet extends DeclarativeWebScript
this.txnId = nodeMetaData.getTxnId();
// 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>();
if(nodeMetaData.getPaths() != null)
{
{
StringBuilder ancestorPath = new StringBuilder();
for(Pair<Path, QName> pair : nodeMetaData.getPaths())
{
JSONObject o = new JSONObject();
o.put("path", solrSerializer.serializeValue(String.class, pair.getFirst()));
o.put("qname", solrSerializer.serializeValue(String.class, pair.getSecond()));
paths.add(o.toString(3));
o.put("qname", solrSerializer.serializeValue(String.class, pair.getSecond()));
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;