Examples of OrderDirection


Examples of org.apache.jackrabbit.oak.plugins.index.property.OrderedIndex.OrderDirection

   
    @Test
    public void queryBetweenIncludeHigher() throws Exception {
        setTravesalEnabled(false);

        final OrderDirection direction = OrderDirection.ASC;
        final String query = "SELECT * FROM [nt:base] WHERE " + ORDERED_PROPERTY + "> $start AND "
                             + ORDERED_PROPERTY + " <= $end";

        // index automatically created by the framework:
        // {@code createTestIndexNode()}
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.index.property.OrderedIndex.OrderDirection

    @Test
    public void queryBetweenIncludeBoth() throws Exception {
        setTravesalEnabled(false);

        final OrderDirection direction = OrderDirection.ASC;
        final String query = "SELECT * FROM [nt:base] WHERE " + ORDERED_PROPERTY + ">= $start AND "
                             + ORDERED_PROPERTY + " <= $end";

        // index automatically created by the framework:
        // {@code createTestIndexNode()}
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.index.property.OrderedIndex.OrderDirection

    @Test
    public void queryGreaterThan() throws Exception {
        initWithProperProvider();
        setTravesalEnabled(false);

        final OrderDirection direction = OrderDirection.ASC;
        final String query = "SELECT * FROM [nt:base] AS n WHERE n.%s > $%s";

        // index automatically created by the framework:
        // {@code createTestIndexNode()}

View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.index.property.OrderedIndex.OrderDirection

    @Test
    public void queryGreaterEqualThan() throws Exception {
        initWithProperProvider();
        setTravesalEnabled(false);

        final OrderDirection direction = OrderDirection.ASC;
        final String query = "SELECT * FROM [nt:base] AS n WHERE n.%s >= $%s";

        // index automatically created by the framework:
        // {@code createTestIndexNode()}

View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.index.property.OrderedIndex.OrderDirection

     * @throws Exception
     */
    @Test
    public void queryLessThan() throws Exception {
        setTravesalEnabled(false);
        final OrderDirection direction = OrderDirection.DESC;
        final String query = "SELECT * FROM [nt:base] AS n WHERE n.%s < $%s";

        // index automatically created by the framework:
        // {@code createTestIndexNode()}

View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.index.property.OrderedIndex.OrderDirection

     * @throws Exception
     */
    @Test
    public void queryLessEqualThan() throws Exception {
        setTravesalEnabled(false);
        final OrderDirection direction = OrderDirection.DESC;
        final String query = "SELECT * FROM [nt:base] AS n WHERE n.%s <= $%s";

        // index automatically created by the framework:
        // {@code createTestIndexNode()}

View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.index.property.OrderedIndex.OrderDirection

    @Test
    public void queryGreaterThenWithCast() throws CommitFailedException, ParseException {

        setTravesalEnabled(false);

        final OrderDirection direction = OrderDirection.ASC;
        final String query = "SELECT * FROM [nt:base] WHERE " + ORDERED_PROPERTY
                             + "> cast('%s' as date)";

        // index automatically created by the framework:
        // {@code createTestIndexNode()}
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.index.property.OrderedIndex.OrderDirection

            } else if (lpr.first != null && !lpr.first.equals(lpr.last)) {
                // > & >= in ascending index
                value = lpr.first.getValue(Type.STRING);
                final String vv = encode(value);
                final boolean include = lpr.firstIncluding;
                final OrderDirection dd = direction;

                Iterable<? extends ChildNodeEntry> children = getChildNodeEntries(content);
                Predicate<String> predicate = new Predicate<String>() {
                    private String v = vv;
                    private boolean i = include;
                    private OrderDirection d = dd;
                   
                    @Override
                    public boolean apply(String input) {
                        boolean b;
                       
                        if (d.equals(OrderDirection.ASC)) {
                            b = v.compareTo(input) > 0;
                        } else {
                            b = v.compareTo(input) < 0;
                        }
                       
                        b = b || (i && v.equals(input));
                       
                        return b;
                    }

                    @Override
                    public String getSearchFor() {
                        throw new UnsupportedOperationException();
                    }
                };

                CountingNodeVisitor v;
                int depthTotal = 0;
                // seeking the right starting point
                for (ChildNodeEntry child : children) {
                    String converted = child.getName();
                    if (predicate.apply(converted)) {
                        // here we are let's start counting
                        v = new CountingNodeVisitor(max);
                        v.visit(content.getChildNode(child.getName()));
                        count += v.getCount();
                        depthTotal += v.depthTotal;
                        if (count > max) {
                            break;
                        }
                    }
                }
                // small hack for having a common way of counting
                v = new CountingNodeVisitor(max);
                v.depthTotal = depthTotal;
                v.count = (int) Math.min(count, Integer.MAX_VALUE);
                count = v.getEstimatedCount();
            } else if (lpr.last != null && !lpr.last.equals(lpr.first)) {
                // < & <=
                value = lpr.last.getValue(Type.STRING);
                final String vv = encode(value);
                final boolean include = lpr.lastIncluding;
                final OrderDirection dd = direction;
               
                Iterable<? extends ChildNodeEntry> children = getChildNodeEntries(content);
                Predicate<String> predicate = new Predicate<String>() {
                    private String v = vv;
                    private boolean i = include;
View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.index.property.OrderedIndex.OrderDirection

     */
    @Test @Ignore("Disabling for now. Integration with OAK-622 and prioritising.")
    public void queryGreaterThan() throws CommitFailedException, ParseException {
        setTravesalEnabled(false);

        final OrderDirection direction = OrderDirection.ASC;
        final String query = "SELECT * FROM [nt:base] AS n WHERE n.%s > $%s";

        // index automatically created by the framework:
        // {@code createTestIndexNode()}

View Full Code Here

Examples of org.apache.jackrabbit.oak.plugins.index.property.OrderedIndex.OrderDirection

     */
    @Test @Ignore("Disabling for now. Integration with OAK-622 and prioritising.")
    public void queryGreaterEqualThan() throws CommitFailedException, ParseException {
        setTravesalEnabled(false);

        final OrderDirection direction = OrderDirection.ASC;
        final String query = "SELECT * FROM [nt:base] AS n WHERE n.%s >= $%s";

        // index automatically created by the framework:
        // {@code createTestIndexNode()}

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.