[ https://issues.apache.org/jira/browse/OAK-2009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14079426#comment-14079426 ]
Tommaso Teofili commented on OAK-2009: -------------------------------------- sample method: {code} public static File createPrimaryTypeSynonymsFile(String path, Session session) throws Exception { File file = new File(path); StringWriter stringWriter = new StringWriter(); NodeTypeIterator allNodeTypes = session.getWorkspace().getNodeTypeManager().getAllNodeTypes(); while (allNodeTypes.hasNext()) { NodeType nodeType = allNodeTypes.nextNodeType(); NodeType[] superTypes = nodeType.getSupertypes(); if (superTypes != null && superTypes.length > 0) { stringWriter.append(nodeType.getName()).append(" => "); for (int i = 0; i < superTypes.length; i++) { stringWriter.append(superTypes[i].getName()); if (i < superTypes.length - 1) { stringWriter.append(','); } stringWriter.append(' '); } stringWriter.append('\n'); } } FileOutputStream fileOutputStream = new FileOutputStream(file); fileOutputStream.write(stringWriter.toString().getBytes("UTF-8")); fileOutputStream.flush(); fileOutputStream.close(); if (file.exists() || file.createNewFile()) { return file; } else { throw new IOException("primary types synonyms file could not be created"); } } {code} > Add a utility method to create Solr synonym file for node type expansions > ------------------------------------------------------------------------- > > Key: OAK-2009 > URL: https://issues.apache.org/jira/browse/OAK-2009 > Project: Jackrabbit Oak > Issue Type: Improvement > Components: oak-solr > Reporter: Tommaso Teofili > Assignee: Tommaso Teofili > > Currently Solr supports filtering by node types but it's not aware of the > node type hierarchy therefore searching for nt:file doesn't expand to > searching for nt:base and nt:hierarchyNode for example. So either we make > this dynamic (which would be possibly slow) or we leverage synonym expansion > and build the synonym file from the node type hierarchy once and use that > when indexing/searching, the open problem is how to deal with changing node > types. -- This message was sent by Atlassian JIRA (v6.2#6252)