IndexDefinition implements Aggregate.AggregateMapper { public boolean isSuggestEnabled() { return suggestEnabled; } 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 testSuggestEnabledOnNamedProp() throws Exception { NodeBuilder rules = builder.child(INDEX_RULES); TestUtil.child(rules, "oak:TestNode/properties/prop2") .setProperty(PROP_NAME, "foo") .setProperty(FulltextIndexConstants.PROP_USE_IN_SUGGEST, true); root = registerTestNodeType(builder).getNodeState(); IndexDefinition idxDefn = new IndexDefinition(root, builder.getNodeState(), "/foo"); assertTrue(idxDefn.isSuggestEnabled()); }
@Test public void testSuggestEnabledOnRegexProp() throws Exception { NodeBuilder rules = builder.child(INDEX_RULES); rules.child(TestUtil.NT_TEST); TestUtil.child(rules, "oak:TestNode/properties/prop2") .setProperty(PROP_NAME, ".*") .setProperty(FulltextIndexConstants.PROP_IS_REGEX, true) .setProperty(FulltextIndexConstants.PROP_USE_IN_SUGGEST, true); root = registerTestNodeType(builder).getNodeState(); IndexDefinition idxDefn = new IndexDefinition(root, builder.getNodeState(), "/foo"); assertTrue(idxDefn.isSuggestEnabled()); }
@Test public void testSuggestDisabled() throws Exception { NodeBuilder rules = builder.child(INDEX_RULES); TestUtil.child(rules, "oak:TestNode/properties/prop2") .setProperty(PROP_NAME, "foo"); root = registerTestNodeType(builder).getNodeState(); IndexDefinition idxDefn = new IndexDefinition(root, builder.getNodeState(), "/foo"); assertFalse(idxDefn.isSuggestEnabled()); }