String fieldName = configuration.getFieldForPathRestriction(pathRestriction); if (fieldName != null) { if (pathRestriction.equals(Filter.PathRestriction.ALL_CHILDREN)) { solrQuery.addFilterQuery(fieldName + ':' + path); } else {
/** * Get the input value for a certain feature (by index) in the given filter. * <p/> * A filter is represented as a vector in R^5 where * i_0 : no. of property restrictions * i_1 : 1 if any native constraint exists in the filter, 0 otherwise * i_2 : the path restriction ordinal * i_3 : the depth of the path restriction if set, 0 otherwise * i_4 : the precedence of the dominant full text constraint if present, 0 otherwise * * @param filter the filter * @param i the index of the filter vector feature to retrieve * @return the feature value */ private long getInput(Filter filter, int i) { assert i < 5; if (i == 0) { return filter.getPropertyRestrictions() != null ? filter.getPropertyRestrictions().size() : 0; } else if (i == 1) { return filter.containsNativeConstraint() ? 1 : 0; } else if (i == 2) { return filter.getPathRestriction() != null ? filter.getPathRestriction().ordinal() : 0; } else if (i == 3) { return filter.getPathRestriction() != null ? filter.getPathRestriction().toString().split("/").length : 0; } else if (i == 4) { return filter.getFullTextConstraint() != null ? filter.getFullTextConstraint().getPrecedence() : 0; } return 0; } }
String p1 = paths.get(r.nextInt(paths.size())); String p2 = paths.get(r.nextInt(paths.size())); Filter.PathRestriction r1 = Filter.PathRestriction.values()[r .nextInt(Filter.PathRestriction.values().length)]; Filter.PathRestriction r2 = Filter.PathRestriction.values()[r .nextInt(Filter.PathRestriction.values().length)]; FilterImpl f1 = FilterImpl.newTestInstance(); f1.restrictPath(p1, r1); fc.restrictPath(p1, r1); fc.restrictPath(p2, r2); fail("not matched: " + p1 + "/" + r1.name() + " && " + p2 + "/" + r2.name()); } else { fail("too many matches: " + p1 + "/" + r1.name() + " && " + p2 + "/" + r2.name() + " superfluous: " + tooMany);
String fieldName = configuration.getFieldForPathRestriction(pathRestriction); if (fieldName != null) { if (pathRestriction.equals(Filter.PathRestriction.ALL_CHILDREN)) { solrQuery.addFilterQuery(fieldName + ':' + path); } else {
filter.getPathRestriction().equals(Filter.PathRestriction.ALL_CHILDREN)) { filterRootPath = filter.getPath();
filter.getPathRestriction().equals(Filter.PathRestriction.ALL_CHILDREN)) { filterRootPath = filter.getPath();
filter.getPathRestriction().equals(Filter.PathRestriction.ALL_CHILDREN)) { filterRootPath = filter.getPath();
!Filter.PathRestriction.NO_RESTRICTION.equals(filter.getPathRestriction()) && configuration.useForPathRestrictions()) { if (match > 0) {
!Filter.PathRestriction.NO_RESTRICTION.equals(filter.getPathRestriction()) && configuration.useForPathRestrictions()) { if (match > 0) {
/** * Get the input value for a certain feature (by index) in the given filter. * <p/> * A filter is represented as a vector in R^5 where * i_0 : no. of property restrictions * i_1 : 1 if any native constraint exists in the filter, 0 otherwise * i_2 : the path restriction ordinal * i_3 : the depth of the path restriction if set, 0 otherwise * i_4 : the precedence of the dominant full text constraint if present, 0 otherwise * * @param filter the filter * @param i the index of the filter vector feature to retrieve * @return the feature value */ private long getInput(Filter filter, int i) { assert i < 5; if (i == 0) { return filter.getPropertyRestrictions() != null ? filter.getPropertyRestrictions().size() : 0; } else if (i == 1) { return filter.containsNativeConstraint() ? 1 : 0; } else if (i == 2) { return filter.getPathRestriction() != null ? filter.getPathRestriction().ordinal() : 0; } else if (i == 3) { return filter.getPathRestriction() != null ? filter.getPathRestriction().toString().split("/").length : 0; } else if (i == 4) { return filter.getFullTextConstraint() != null ? filter.getFullTextConstraint().getPrecedence() : 0; } return 0; } }
PathIterator(Filter filter, String indexName, String pathPrefix, boolean prependPathPrefix) { this.filter = filter; this.pathPrefix = pathPrefix; this.indexName = indexName; boolean shouldDescendDirectly = filter.getPathRestriction().equals(Filter.PathRestriction.ALL_CHILDREN); if (shouldDescendDirectly) { filterPath = filter.getPath(); if (PathUtils.denotesRoot(filterPath)) { filterPath = ""; } } else { filterPath = ""; } parentPath = ""; currentPath = "/"; this.settings = filter.getQueryLimits(); this.prependPathPrefix = prependPathPrefix; }
PathIterator(Filter filter, String indexName, String pathPrefix, boolean prependPathPrefix) { this.filter = filter; this.pathPrefix = pathPrefix; this.indexName = indexName; boolean shouldDescendDirectly = filter.getPathRestriction().equals(Filter.PathRestriction.ALL_CHILDREN); if (shouldDescendDirectly) { filterPath = filter.getPath(); if (PathUtils.denotesRoot(filterPath)) { filterPath = ""; } } else { filterPath = ""; } parentPath = ""; currentPath = "/"; this.settings = filter.getQueryLimits(); this.prependPathPrefix = prependPathPrefix; }
PathIterator(Filter filter, String indexName, String pathPrefix, boolean prependPathPrefix) { this.filter = filter; this.pathPrefix = pathPrefix; this.indexName = indexName; boolean shouldDescendDirectly = filter.getPathRestriction().equals(Filter.PathRestriction.ALL_CHILDREN); if (shouldDescendDirectly) { filterPath = filter.getPath(); if (PathUtils.denotesRoot(filterPath)) { filterPath = ""; } } else { filterPath = ""; } parentPath = ""; currentPath = "/"; this.settings = filter.getQueryLimits(); this.prependPathPrefix = prependPathPrefix; }
@Override public String getPathPlan() { return PathRestriction.NO_RESTRICTION.toString(); }
@Override public String getPathPlan() { return PathRestriction.NO_RESTRICTION.toString(); }