private void addPropIndexDefn(NodeBuilder parent, String propName){ try { NodeBuilder idx = IndexUtils.createIndexDefinition(parent, propName, false, singleton(propName), null, "property", null); if ( propName.equals(indexedPropName)) { idx.setProperty("tags", singletonList("fooIndex"), Type.STRINGS); } } catch (RepositoryException e) { throw new RuntimeException(e); } } }
@Override public void initialize(@NotNull NodeBuilder builder) { NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder); IndexUtils.createIndexDefinition(index, "myProp", true, false, ImmutableList.<String>of("myProp"), null); } })
@Nullable public static String getAsyncLaneName(NodeState idxState, String indexPath) { return getAsyncLaneName(idxState, indexPath, idxState.getProperty(IndexConstants.ASYNC_PROPERTY_NAME)); }
NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder); NodeBuilder uuid = IndexUtils.createIndexDefinition(index, "uuid", true, true, ImmutableList.<String>of(JCR_UUID), null); uuid.setProperty("info", "Oak index for UUID lookup (direct lookup of nodes with the mixin 'mix:referenceable')."); NodeBuilder nodetype = IndexUtils.createIndexDefinition(index, "nodetype", true, false, ImmutableList.of(JCR_PRIMARYTYPE, JCR_MIXINTYPES), null); nodetype.setProperty("info", "Oak index for queries with node type, and possibly path restrictions, " + "for example \"/jcr:root/content//element(*, mix:language)\"."); IndexUtils.createReferenceIndex(index);
@Override public void initialize(@NotNull NodeBuilder builder) { NodeBuilder oakIndex = IndexUtils.getOrCreateOakIndex(builder); addPropIndexDefn(oakIndex, indexedPropName); for (int i = 0; i < numOfIndexes - 1; i++) { addPropIndexDefn(oakIndex, indexedPropName + i); } }
public static boolean isIndexNodeType(NodeState state, String typeIn) { if (!isIndexNodeType(state)) { return false; } PropertyState type = state.getProperty(TYPE_PROPERTY_NAME); return type != null && !type.isArray() && type.getValue(Type.STRING).equals(typeIn); }
NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder); NodeBuilder uuid = IndexUtils.createIndexDefinition(index, "uuid", true, true, ImmutableList.<String>of(JCR_UUID), null); uuid.setProperty("info", "Oak index for UUID lookup (direct lookup of nodes with the mixin 'mix:referenceable')."); NodeBuilder nodetype = IndexUtils.createIndexDefinition(index, "nodetype", true, false, ImmutableList.of(JCR_PRIMARYTYPE, JCR_MIXINTYPES), null); nodetype.setProperty("info", "Oak index for queries with node type, and possibly path restrictions, " + "for example \"/jcr:root/content//element(*, mix:language)\"."); IndexUtils.createReferenceIndex(index);
@Override public void initialize(@NotNull NodeBuilder builder) { NodeBuilder oakIndex = IndexUtils.getOrCreateOakIndex(builder); IndexDefinitionBuilder defnBuilder = new IndexDefinitionBuilder(); defnBuilder.async("async", "async"); defnBuilder.codec("Lucene46"); defnBuilder.indexRule("nt:base") .property(FulltextIndexConstants.REGEX_ALL_PROPS, true) .nodeScopeIndex(); oakIndex.setChildNode("globalIndex", defnBuilder.build()); } }
public static boolean isIndexNodeType(NodeState state, String typeIn) { if (!isIndexNodeType(state)) { return false; } PropertyState type = state.getProperty(TYPE_PROPERTY_NAME); return type != null && !type.isArray() && type.getValue(Type.STRING).equals(typeIn); }
/** * A convenience method to create a non-unique property index. */ private static void property(NodeBuilder index, String indexName, String propertyName) { if (!index.hasChildNode(indexName)) { createIndexDefinition(index, indexName, true, false, singleton(propertyName), null); } }
@Override public void initialize(@NotNull NodeBuilder builder) { NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder); IndexUtils.createIndexDefinition( index, "xyz", true, false, ImmutableList.of("x", "y", "z", "w"), null); } })
NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder); NodeBuilder uuid = IndexUtils.createIndexDefinition(index, "uuid", true, true, ImmutableList.<String>of(JCR_UUID), null); uuid.setProperty("info", "Oak index for UUID lookup (direct lookup of nodes with the mixin 'mix:referenceable')."); NodeBuilder nodetype = IndexUtils.createIndexDefinition(index, "nodetype", true, false, ImmutableList.of(JCR_PRIMARYTYPE, JCR_MIXINTYPES), null); nodetype.setProperty("info", "Oak index for queries with node type, and possibly path restrictions, " + "for example \"/jcr:root/content//element(*, mix:language)\"."); IndexUtils.createReferenceIndex(index);
@Nullable public static String getAsyncLaneName(NodeState idxState, String indexPath) { return getAsyncLaneName(idxState, indexPath, idxState.getProperty(IndexConstants.ASYNC_PROPERTY_NAME)); }
@Override public void initialize(@NotNull NodeBuilder builder) { NodeBuilder oakIndex = IndexUtils.getOrCreateOakIndex(builder); IndexDefinitionBuilder defnBuilder = new IndexDefinitionBuilder(); defnBuilder.evaluatePathRestrictions(); defnBuilder.async("async", indexingMode, "async"); PropertyRule pr = defnBuilder.indexRule("nt:base").property(indexedPropName).propertyIndex(); if (syncIndexing) { pr.sync(); } if (useOakCodec) { defnBuilder.codec("oakCodec"); } for (int i = 0; i < numOfIndexes - 1; i++) { defnBuilder.indexRule("nt:base").property(indexedPropName + i).propertyIndex(); } oakIndex.setChildNode(indexedPropName, defnBuilder.build()); oakIndex.child(indexedPropName).setProperty("tags", singletonList("fooIndex"), Type.STRINGS); } }
public static boolean isIndexNodeType(NodeState state, String typeIn) { if (!isIndexNodeType(state)) { return false; } PropertyState type = state.getProperty(TYPE_PROPERTY_NAME); return type != null && !type.isArray() && type.getValue(Type.STRING).equals(typeIn); }
/** * Create a new property2 index definition below the given {@code indexNode}. * * @param indexNode * @param indexDefName * @param unique * @param propertyNames * @param declaringNodeTypeNames */ public static Tree createIndexDefinition(@Nonnull Tree indexNode, @Nonnull String indexDefName, boolean unique, @Nonnull String[] propertyNames, @Nonnull String... declaringNodeTypeNames) throws RepositoryException { return createIndexDefinition(indexNode, indexDefName, unique, ImmutableList.copyOf(propertyNames), ImmutableList.copyOf(declaringNodeTypeNames), PropertyIndexEditorProvider.TYPE, null); }
@Override public void initialize(@NotNull NodeBuilder builder) { // create index definition for "rep:externalId" and // "rep:externalPrincipalNames" NodeBuilder index = IndexUtils.getOrCreateOakIndex(builder); if (enforceUniqueIds && !index.hasChildNode("externalId")) { NodeBuilder definition = IndexUtils.createIndexDefinition(index, "externalId", true, true, ImmutableList.of(ExternalIdentityConstants.REP_EXTERNAL_ID), null); definition.setProperty("info", "Oak index assuring uniqueness of rep:externalId properties."); } if (!index.hasChildNode("externalPrincipalNames")) { NodeBuilder definition = IndexUtils.createIndexDefinition(index, "externalPrincipalNames", true, false, ImmutableList.of(ExternalIdentityConstants.REP_EXTERNAL_PRINCIPAL_NAMES), null); definition.setProperty("info", "Oak index used by the principal management provided by the external authentication module."); } } }
@CheckForNull public static String getAsyncLaneName(NodeState idxState, String indexPath) { return getAsyncLaneName(idxState, indexPath, idxState.getProperty(IndexConstants.ASYNC_PROPERTY_NAME)); }
NodeBuilder lucene = IndexUtils.getOrCreateOakIndex( root ).child( "lucene" ); lucene.setProperty( JcrConstants.JCR_PRIMARYTYPE, "oak:QueryIndexDefinition", Type.NAME );
/** * Create a new property2 index definition below the given {@code indexNode}. * * @param indexNode * @param indexDefName * @param unique * @param propertyNames * @param declaringNodeTypeNames */ public static Tree createIndexDefinition(@NotNull Tree indexNode, @NotNull String indexDefName, boolean unique, @NotNull String[] propertyNames, @NotNull String... declaringNodeTypeNames) throws RepositoryException { return createIndexDefinition(indexNode, indexDefName, unique, ImmutableList.copyOf(propertyNames), ImmutableList.copyOf(declaringNodeTypeNames), PropertyIndexEditorProvider.TYPE, null); }