Package org.apache.jackrabbit.oak.spi.query.Filter

Examples of org.apache.jackrabbit.oak.spi.query.Filter.PropertyRestriction


            // when using the LowCostLuceneIndexProvider
            // which is used for testing
        } else {
            qs.add(getFullTextQuery(ft, analyzer, reader));
        }
        PropertyRestriction pr = filter.getPropertyRestriction(NATIVE_QUERY_FUNCTION);
        if (pr != null) {
            String query = String.valueOf(pr.first.getValue(pr.first.getType()));
            QueryParser queryParser = new QueryParser(VERSION, "", analyzer);
            if (query.startsWith("mlt?")) {
                String mltQueryString = query.replace("mlt?", "");
View Full Code Here


            // when using the LowCostLuceneIndexProvider
            // which is used for testing
        } else {
            qs.add(getFullTextQuery(ft, analyzer, reader));
        }
        PropertyRestriction pr = filter.getPropertyRestriction(NATIVE_QUERY_FUNCTION);
        if (pr != null) {
            String query = String.valueOf(pr.first.getValue(pr.first.getType()));
            QueryParser queryParser = new QueryParser(VERSION, "", analyzer);
            if (query.startsWith("mlt?")) {
                String mltQueryString = query.replace("mlt?", "");
View Full Code Here

                // we could be here if we have a query where the ORDER BY makes us play it.
                for (OrderEntry oe : sortOrder) {
                    String propertyName = PathUtils.getName(oe.getPropertyName());
                    depth = PathUtils.getDepth(oe.getPropertyName());
                    if (lookup.isIndexed(propertyName, "/", null)) {
                        paths = lookup.query(filter, propertyName, new PropertyRestriction());
                    }
                }
            }
            if (paths == null) {
                // if still here then something went wrong.
View Full Code Here

            if (paths == null && sortOrder != null && !sortOrder.isEmpty()) {
                // we could be here if we have a query where the ORDER BY makes us play it.
                for (OrderEntry oe : sortOrder) {
                    String propertyName = PathUtils.getName(oe.getPropertyName());
                    if (lookup.isIndexed(propertyName, "/", null)) {
                        paths = lookup.query(filter, propertyName, new PropertyRestriction());
                    }
                }
            }
            if (paths == null) {
                // if still here then something went wrong.
View Full Code Here

        return "jcr:uuid";
    }

    @Override
    public double getCost(Filter filter) {
        PropertyRestriction pr = filter.getPropertyRestriction("jcr:uuid");
        if (pr != null
                && "/".equals(filter.getPath())
                && filter.getPathRestriction() == Filter.PathRestriction.ALL_CHILDREN
                && filter.getFulltextConditions().isEmpty()
                && filter.getPropertyRestrictions().size() == 1) {
View Full Code Here

        if (state == null) {
            state = MemoryNodeState.EMPTY_NODE;
        }

        List<String> paths = Lists.newArrayList();
        PropertyRestriction pr = filter.getPropertyRestriction("jcr:uuid");
        String value = pr.first.getString();
        try {
            value = URLEncoder.encode(value, Charsets.UTF_8.name());
        } catch (UnsupportedEncodingException e) {
            // ignore
View Full Code Here

            // when using the LowCostLuceneIndexProvider
            // which is used for testing
        } else {
            qs.add(getFullTextQuery(ft, analyzer, reader));
        }
        PropertyRestriction pr = filter.getPropertyRestriction(NATIVE_QUERY_FUNCTION);
        if (pr != null) {
            String query = String.valueOf(pr.first.getValue(pr.first.getType()));
            QueryParser queryParser = new QueryParser(VERSION, "", analyzer);
            if (query.startsWith("mlt?")) {
                String mltQueryString = query.replace("mlt?", "");
View Full Code Here

                // we could be here if we have a query where the ORDER BY makes us play it.
                for (OrderEntry oe : sortOrder) {
                    String propertyName = PathUtils.getName(oe.getPropertyName());
                    depth = PathUtils.getDepth(oe.getPropertyName());
                    if (lookup.isIndexed(propertyName, "/", null)) {
                        paths = lookup.query(filter, propertyName, new PropertyRestriction());
                    }
                }
            }
            if (paths == null) {
                // if still here then something went wrong.
View Full Code Here

        PropertyIndexLookup lookup = getLookup(root);
        int depth = 1;

        Cheapest cheapest = findCheapestProperty(filter, lookup);
        PropertyRestriction pr = cheapest.propertyRestriction;

        if (pr != null) {
            String propertyName = PathUtils.getName(pr.propertyName);
            depth = PathUtils.getDepth(pr.propertyName);
            // TODO support indexes on a path
View Full Code Here

    public String getPlan(Filter filter, NodeState root) {
        StringBuilder buff = new StringBuilder("property");
        StringBuilder notIndexed = new StringBuilder();
        PropertyIndexLookup lookup = getLookup(root);
        Cheapest cheapest = findCheapestProperty(filter, lookup);
        PropertyRestriction pr = cheapest.propertyRestriction;

        if (pr != null) {
            String propertyName = PathUtils.getName(pr.propertyName);
            // TODO support indexes on a path
            // currently, only indexes on the root node are supported
            if (lookup.isIndexed(propertyName, "/", filter)) {
                if (pr.firstIncluding && pr.lastIncluding
                    && pr.first != null && pr.first.equals(pr.last)) {
                    buff.append(' ').append(propertyName).append('=').append(pr.first);
                } else {
                    buff.append(' ').append(propertyName);
                }
            } else if (pr.list != null) {
                buff.append(' ').append(propertyName).append(" IN(");
                int i = 0;
                for (PropertyValue pv : pr.list) {
                    if (i++ > 0) {
                        buff.append(", ");
                    }
                    buff.append(pv);
                }
                buff.append(')');
            } else {
                notIndexed.append(' ').append(propertyName);
                if (!pr.toString().isEmpty()) {
                    notIndexed.append(':').append(pr);
                }
            }
        }
        if (notIndexed.length() > 0) {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.query.Filter.PropertyRestriction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.