Filter.PathRestriction pathRestriction = filter.getPathRestriction(); if (pathRestriction != null) { String path = purgePath(filter, plan.getPathPrefix()); String fieldName = configuration.getFieldForPathRestriction(pathRestriction); if (fieldName != null) {
Filter.PathRestriction pathRestriction = filter.getPathRestriction(); if (pathRestriction != null) { String path = purgePath(filter, plan.getPathPrefix()); String fieldName = configuration.getFieldForPathRestriction(pathRestriction); if (fieldName != null) {
@SuppressWarnings("Guava") private static Iterator<FulltextResultRow> mergePropertyIndexResult(IndexPlan plan, NodeState rootState, Iterator<FulltextResultRow> itr) { PlanResult pr = getPlanResult(plan); HybridPropertyIndexLookup lookup = new HybridPropertyIndexLookup(pr.indexPath, NodeStateUtils.getNode(rootState, pr.indexPath), plan.getPathPrefix(), false); PropertyIndexResult pir = pr.getPropertyIndexResult(); FluentIterable<String> paths = null; if (pir != null) { Iterable<String> queryResult = lookup.query(plan.getFilter(), pir.propertyName, pir.pr); paths = FluentIterable.from(queryResult) .transform(path -> pr.isPathTransformed() ? pr.transformPath(path) : path) .filter(notNull()); } else { checkState(pr.evaluateSyncNodeTypeRestriction()); //Either of property or nodetype should not be null Filter filter = plan.getFilter(); paths = FluentIterable.from(Iterables.concat( lookup.query(filter, JCR_PRIMARYTYPE, newName(filter.getPrimaryTypes())), lookup.query(filter, JCR_MIXINTYPES, newName(filter.getMixinTypes())))); } //No need for path restriction evaluation as thats taken care by PropertyIndex impl itself //via content mirror strategy FluentIterable<FulltextResultRow> propIndex = paths .transform(path -> new FulltextResultRow(path, 0, null, null, null)); //Property index itr should come first return Iterators.concat(propIndex.iterator(), itr); }
public FulltextPathCursor(final Iterator<FulltextResultRow> it, final IndexPlan plan, QueryLimits settings, SizeEstimator sizeEstimator) { pathPrefix = plan.getPathPrefix(); this.sizeEstimator = sizeEstimator; Iterator<String> pathIterator = new Iterator<String>() { private int readCount; @Override public boolean hasNext() { return it.hasNext(); } @Override public String next() { currentRow = it.next(); readCount++; if (readCount % TRAVERSING_WARNING == 0) { Cursors.checkReadLimit(readCount, settings); log.warn("Index-Traversed {} nodes with filter {}", readCount, plan.getFilter()); } return currentRow.path; } @Override public void remove() { it.remove(); } }; PlanResult planResult = getPlanResult(plan); pathCursor = new PathCursor(pathIterator, planResult.isUniquePathsRequired(), settings); numberOfFacets = planResult.indexDefinition.getNumberOfTopFacets(); }
@SuppressWarnings("Guava") private static Iterator<FulltextResultRow> mergePropertyIndexResult(IndexPlan plan, NodeState rootState, Iterator<FulltextResultRow> itr) { PlanResult pr = getPlanResult(plan); HybridPropertyIndexLookup lookup = new HybridPropertyIndexLookup(pr.indexPath, NodeStateUtils.getNode(rootState, pr.indexPath), plan.getPathPrefix(), false); PropertyIndexResult pir = pr.getPropertyIndexResult(); FluentIterable<String> paths = null; if (pir != null) { Iterable<String> queryResult = lookup.query(plan.getFilter(), pir.propertyName, pir.pr); paths = FluentIterable.from(queryResult) .transform(path -> pr.isPathTransformed() ? pr.transformPath(path) : path) .filter(notNull()); } else { checkState(pr.evaluateSyncNodeTypeRestriction()); //Either of property or nodetype should not be null Filter filter = plan.getFilter(); paths = FluentIterable.from(Iterables.concat( lookup.query(filter, JCR_PRIMARYTYPE, newName(filter.getPrimaryTypes())), lookup.query(filter, JCR_MIXINTYPES, newName(filter.getMixinTypes())))); } //No need for path restriction evaluation as thats taken care by PropertyIndex impl itself //via content mirror strategy FluentIterable<FulltextResultRow> propIndex = paths .transform(path -> new FulltextResultRow(path, 0, null, null, null)); //Property index itr should come first return Iterators.concat(propIndex.iterator(), itr); }
@Override public String getPath() { String sub = pathRow.getPath(); if (isVirtualRow()) { return sub; } else if (PathUtils.isAbsolute(sub)) { return plan.getPathPrefix() + sub; } else { return PathUtils.concat(plan.getPathPrefix(), sub); } }
@Override public String getPath() { String sub = pathRow.getPath(); if (isVirtualRow()) { return sub; } else if (PathUtils.isAbsolute(sub)) { return plan.getPathPrefix() + sub; } else { return PathUtils.concat(plan.getPathPrefix(), sub); } }
protected static String getPathRestriction(IndexPlan plan) { Filter f = plan.getFilter(); String pathPrefix = plan.getPathPrefix(); if (pathPrefix.isEmpty()) { return f.getPath(); } String relativePath = PathUtils.relativize(pathPrefix, f.getPath()); return "/" + relativePath; }