IndexDefinition implements Aggregate.AggregateMapper { public long getFulltextEntryCount(long numOfDocs){ if (isEntryCountDefined()){ return Math.min(getEntryCount(), numOfDocs); } return numOfDocs; } 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 fulltextCost() throws Exception{ NodeBuilder defnb = newFTPropertyIndexDefinition(builder.child(INDEX_DEFINITIONS_NAME), "foo", "lucene", of("foo"), "async"); IndexDefinition defn = new IndexDefinition(root, defnb.getNodeState(), "/foo"); assertEquals(300, defn.getFulltextEntryCount(300)); assertEquals(IndexDefinition.DEFAULT_ENTRY_COUNT + 100, defn.getFulltextEntryCount(IndexDefinition.DEFAULT_ENTRY_COUNT + 100)); defnb.setProperty(IndexConstants.ENTRY_COUNT_PROPERTY_NAME, 100); defn = new IndexDefinition(root, defnb.getNodeState(), "/foo"); assertEquals(100, defn.getFulltextEntryCount(300)); assertEquals(50, defn.getFulltextEntryCount(50)); }