IndexDefinition implements Aggregate.AggregateMapper { public static Builder newBuilder(NodeState root, NodeState defn, String indexPath){ return new Builder().root(root).defn(defn).indexPath(indexPath); } IndexDefinition(NodeState root, NodeState defn, String indexPath); protected  IndexDefinition(NodeState root, NodeState defn, IndexFormatVersion version, String uid, String indexPath); boolean isTestMode(); static Builder newBuilder(NodeState root, NodeState defn, String indexPath); NodeState getDefinitionNodeState(); boolean isEnabled(); boolean isFullTextEnabled(); String getFunctionName(); boolean hasFunctionDefined(); int getBlobSize(); long getReindexCount(); long getEntryCount(); int getSuggesterUpdateFrequencyMinutes(); boolean isEntryCountDefined(); double getCostPerEntry(); double getCostPerExecution(); long getFulltextEntryCount(long numOfDocs); boolean isDeprecated(); IndexFormatVersion getVersion(); boolean isOfOldFormat(); boolean evaluatePathRestrictions(); boolean hasCustomTikaConfig(); InputStream getTikaConfig(); String getTikaMappedMimeType(String type); String getIndexName(); String[] getIndexTags(); int getMaxExtractLength(); String getScorerProviderName(); PathFilter getPathFilter(); @Nullable String[] getQueryPaths(); @Nullable String getUniqueId(); boolean isNRTIndexingEnabled(); boolean isSyncIndexingEnabled(); boolean hasSyncPropertyDefinitions(); boolean isPureNodeTypeIndex(); static boolean hasPersistedIndex(NodeState definition); static boolean isDisableStoredIndexDefinition(); static void setDisableStoredIndexDefinition(boolean disableStoredIndexDefinitionDefault); Set<String> getRelativeNodeNames(); boolean indexesRelativeNodes(); @Override String toString(); @Nullable Aggregate getAggregate(String nodeType); boolean hasMatchingNodeTypeReg(NodeState root); List<IndexingRule> getDefinedRules(); @Nullable IndexingRule getApplicableIndexingRule(String primaryNodeType); @Nullable IndexingRule getApplicableIndexingRule(NodeState state); Pattern getPropertyRegex(); boolean isSuggestEnabled(); boolean isSpellcheckEnabled(); String getIndexPath(); boolean isSuggestAnalyzed(); SecureFacetConfiguration getSecureFacetConfiguration(); int getNumberOfTopFacets(); static NodeBuilder updateDefinition(NodeBuilder indexDefn); static NodeBuilder updateDefinition(NodeBuilder indexDefn, String indexPath); static boolean supportsSyncOrNRTIndexing(NodeBuilder defn); static final int DEFAULT_BLOB_SIZE; static final long DEFAULT_ENTRY_COUNT; static final int DEFAULT_MAX_FIELD_LENGTH; static final int DEFAULT_MAX_EXTRACT_LENGTH; static final String INDEX_VERSION; static final String INDEX_DEFINITION_NODE; static final String STATUS_NODE; static final String STATUS_LAST_UPDATED; static final String CREATION_TIMESTAMP; static final String REINDEX_COMPLETION_TIMESTAMP; static final String FAILED_DOC_PATHS; static final String PROP_UID; static final int DEFAULT_SUGGESTER_UPDATE_FREQUENCY_MINUTES; static final OrderEntry NATIVE_SORT_ORDER; }
@Test public void nodeTypeIndexed_IgnoreOtherProps() throws Exception{ TestUtil.registerNodeType(builder, testNodeTypeDefn); root = builder.getNodeState(); IndexDefinitionBuilder defnb = new IndexDefinitionBuilder(); defnb.nodeTypeIndex(); defnb.indexRule("oak:TestSuperType").sync(); defnb.indexRule("oak:TestSuperType").property("foo").propertyIndex(); IndexDefinition defn = IndexDefinition.newBuilder(root, defnb.build(), "/foo").build(); IndexingRule ruleSuper = getRule(defn, "oak:TestSuperType"); assertNotNull(ruleSuper); assertNull(ruleSuper.getConfig("foo")); assertNotNull(ruleSuper.getConfig(JcrConstants.JCR_PRIMARYTYPE)); assertNotNull(ruleSuper.getConfig(JcrConstants.JCR_MIXINTYPES)); }
@Test public void mixinAndPrimaryType() throws Exception{ TestUtil.registerNodeType(builder, testNodeTypeDefn); root = builder.getNodeState(); IndexDefinitionBuilder defnb = new IndexDefinitionBuilder(); defnb.indexRule("oak:TestMixA").property(JcrConstants.JCR_PRIMARYTYPE).propertyIndex(); defnb.indexRule("oak:TestSuperType").property(JcrConstants.JCR_PRIMARYTYPE).propertyIndex().sync(); IndexDefinition defn = IndexDefinition.newBuilder(root, defnb.build(), "/foo").build(); IndexingRule a = getRule(defn, "oak:TestMixA"); assertNotNull(a.getConfig(JcrConstants.JCR_PRIMARYTYPE)); assertNotNull(a.getConfig(JcrConstants.JCR_MIXINTYPES)); assertFalse(a.getConfig(JcrConstants.JCR_MIXINTYPES).sync); IndexingRule b = getRule(defn, "oak:TestSuperType"); assertNotNull(b.getConfig(JcrConstants.JCR_PRIMARYTYPE)); assertNotNull(b.getConfig(JcrConstants.JCR_MIXINTYPES)); assertTrue(b.getConfig(JcrConstants.JCR_PRIMARYTYPE).sync); assertTrue(b.getConfig(JcrConstants.JCR_MIXINTYPES).sync); }