如何在给定节点下列出多个属性的所有属性和相应值。
例如,下面的代码,我只能搜索一个属性。但我需要搜索 10 个不同的属性(alttext、img、promos.. 等)并为其获取相应的值(如果存在)。
Map<String, String> map = new HashMap<String, String>();
map.put(TYPE_PREDICATE, "nt:base");
map.put(PATH_PREDICATE, printAttachmentJsonNodePath);
map.put("property", "fileReference");
map.put("p.excerpt", "true");
map.put(SEARCH_LIMIT_PREDICATE, "-1");
Query query = queryBuilder.createQuery(PredicateGroup.create(map),
resourceResolver.adaptTo(Session.class));
SearchResult result = query.getResult();
for (Hit hit : result.getHits()) {
String path = hit.getPath();
Resource resourceHit = resourceResolver.getResource(path);
Node node = resourceHit.adaptTo(Node.class);
String fileReference = node.getProperty("fileReference").getString();
System.out.println(fileReference);
}