public IndexPlan getPlan() { if (definition == null) { log.debug("Index {} not loaded", indexPath); return null; } IndexPlan.Builder builder = getPlanBuilder(); if (definition.isTestMode()){ if (builder == null) { if (notSupportedFeature()) { return null; } String msg = String.format("No plan found for filter [%s] " + "while using definition [%s] and testMode is found to be enabled", filter, definition); throw new IllegalStateException(msg); } else { builder.setEstimatedEntryCount(1) .setCostPerExecution(1e-3) .setCostPerEntry(1e-3); } } return builder != null ? builder.build() : null; }
return Collections.singletonList(planBuilder(filter) .setEstimatedEntryCount(defn.getFulltextEntryCount(stats.numDocs())) .setCostPerExecution(defn.getCostPerExecution()) .setCostPerEntry(defn.getCostPerEntry()) .setDeprecated(defn.isDeprecated())
return Collections.singletonList(planBuilder(filter) .setEstimatedEntryCount(defn.getFulltextEntryCount(node.getIndexStatistics().numDocs())) .setCostPerExecution(defn.getCostPerExecution()) .setCostPerEntry(defn.getCostPerEntry()) .setDeprecated(defn.isDeprecated())
@Nullable private IndexPlan.Builder defaultPlan() { // With OAK-7947 lucene indexes return a non-null index node to delay reading index files // While IndexNode could have a status check method but for now we are using this work-around // to check null on {@code getIndexStatistics()} as proxy indicator // (this could be avoided by returning lazy statistics) if (indexNode.getIndexStatistics() == null) { return null; } return new IndexPlan.Builder() .setCostPerExecution(definition.getCostPerExecution()) .setCostPerEntry(definition.getCostPerEntry()) .setFulltextIndex(definition.isFullTextEnabled()) .setIncludesNodeData(false) // we should not include node data .setFilter(filter) .setPathPrefix(getPathPrefix()) .setSupportsPathRestriction(definition.evaluatePathRestrictions()) .setDelayed(true) //Lucene is always async .setDeprecated(definition.isDeprecated()) .setAttribute(FulltextIndex.ATTR_PLAN_RESULT, result) .setEstimatedEntryCount(estimatedEntryCount()) .setPlanName(indexPath); }
private IndexPlan.Builder planBuilder(Filter filter) { return new IndexPlan.Builder() .setCostPerExecution(1.5) // disk I/O + network I/O .setCostPerEntry(0.3) // with properly configured SolrCaches ~70% of the doc fetches should hit them .setFilter(filter) .setFulltextIndex(true) .setIncludesNodeData(true) // we currently include node data .setDelayed(true); //Solr is most usually async }
private IndexPlan.Builder planBuilder(Filter filter) { return new IndexPlan.Builder() .setCostPerExecution(1.5) // disk I/O + network I/O .setCostPerEntry(0.3) // with properly configured SolrCaches ~70% of the doc fetches should hit them .setFilter(filter) .setFulltextIndex(true) .setIncludesNodeData(true) // we currently include node data .setDelayed(true); //Solr is most usually async }
@Override public List<IndexPlan> getPlans(Filter filter, List<OrderEntry> sortOrder, NodeState rootState) { String indexPath = LuceneIndexLookupUtil.getOldFullTextIndexPath(rootState, filter, tracker); if (indexPath == null){ return Collections.emptyList(); } return Collections.singletonList(planBuilder(filter) .setCostPerExecution(getMinimumCost()) .setAttribute(ATTR_INDEX_PATH, indexPath) .build()); } }
protected static IndexPlan.Builder planBuilder(Filter filter){ return new IndexPlan.Builder() .setCostPerExecution(0) // we're local. Low-cost .setCostPerEntry(1) .setFilter(filter) .setFulltextIndex(true) .setEstimatedEntryCount(0) //TODO Fake it to provide constant cost for now .setIncludesNodeData(false) // we should not include node data .setDelayed(true); //Lucene is always async }
void addPlan(String name, long cost, boolean supportsPathRestriction) { plans.add(new IndexPlan.Builder() .setCostPerEntry(1) .setCostPerExecution(1) .setEstimatedEntryCount(cost) .setSupportsPathRestriction(supportsPathRestriction) .setPlanName(name) .build()); }
protected static IndexPlan.Builder planBuilder(Filter filter){ return new IndexPlan.Builder() .setCostPerExecution(0) // we're local. Low-cost .setCostPerEntry(1) .setFilter(filter) .setFulltextIndex(true) .setEstimatedEntryCount(0) //TODO Fake it to provide constant cost for now .setIncludesNodeData(false) // we should not include node data .setDelayed(true); //Lucene is always async }