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

Examples of org.apache.jackrabbit.oak.spi.query.Cursor


        AdvancedQueryIndex queryIndex = new LuceneIndex(tracker, analyzer, null);
        FilterImpl filter = createFilter(NT_BASE);
        filter.restrictPath("/", Filter.PathRestriction.EXACT);
        filter.restrictProperty("foo", Operator.EQUAL,
                PropertyValues.newString("bar"));
        Cursor cursor = queryIndex.query(createPlan(filter), indexed);
        assertTrue(cursor.hasNext());
        assertEquals("/", cursor.next().getPath());
        assertFalse(cursor.hasNext());
    }
View Full Code Here


        tracker.update(indexed);
        AdvancedQueryIndex queryIndex = new LuceneIndex(tracker, analyzer, null);
        FilterImpl filter = createFilter(NT_BASE);
        filter.restrictProperty("foo", Operator.EQUAL,
                PropertyValues.newString("bar"));
        Cursor cursor = queryIndex.query(createPlan(filter), indexed);

        List<String> paths = copyOf(transform(cursor, new Function<IndexRow, String>() {
            public String apply(IndexRow input) {
                return input.getPath();
            }
View Full Code Here

        AdvancedQueryIndex queryIndex = new LuceneIndex(tracker, analyzer, null);
        FilterImpl filter = createFilter(NT_BASE);
        // filter.restrictPath("/", Filter.PathRestriction.EXACT);
        filter.restrictProperty("foo", Operator.EQUAL,
                PropertyValues.newString("bar"));
        Cursor cursor = queryIndex.query(createPlan(filter), indexed);

        assertTrue(cursor.hasNext());
        assertEquals("/a/b/c", cursor.next().getPath());
        assertEquals("/a/b", cursor.next().getPath());
        assertEquals("/a", cursor.next().getPath());
        assertEquals("/", cursor.next().getPath());
        assertFalse(cursor.hasNext());
    }
View Full Code Here

        AdvancedQueryIndex queryIndex = new LuceneIndex(tracker, analyzer, null);
        FilterImpl filter = createFilter(NT_BASE);
        // filter.restrictPath("/", Filter.PathRestriction.EXACT);
        filter.restrictProperty("foo", Operator.EQUAL,
                PropertyValues.newString("bar"));
        Cursor cursor = queryIndex.query(createPlan(filter), indexed);

        assertTrue(cursor.hasNext());
        assertEquals("/a", cursor.next().getPath());
        assertEquals("/", cursor.next().getPath());
        assertFalse(cursor.hasNext());
    }
View Full Code Here

        AdvancedQueryIndex queryIndex = new LuceneIndex(tracker, analyzer, null);
        FilterImpl filter = createFilter(NT_BASE);
        filter.restrictPath("/", Filter.PathRestriction.EXACT);
        filter.restrictProperty(key, Operator.EQUAL,
                PropertyValues.newString(value));
        Cursor cursor = queryIndex.query(createPlan(filter), indexed);
        assertTrue(cursor.hasNext());
        assertEquals("/", cursor.next().getPath());
        assertFalse(cursor.hasNext());
    }
View Full Code Here

            @Override
            public boolean visit(FullTextAnd and) {
                Iterator<FullTextExpression> iterator = and.list.iterator();
                int index = 0;
                Cursor c = flatten(iterator.next(), plan, filter, state,
                        path + " and(" + index + ")");
                while (iterator.hasNext()) {
                    index++;
                    FullTextExpression input = iterator.next();
                    Cursor newC = flatten(input, plan, filter, state,
                            path + " and(" + index + ")");
                    c = Cursors.newIntersectionCursor(c, newC,
                            filter.getQueryEngineSettings());
                }
                result.set(c);
View Full Code Here

            }
        });
    }

    private Cursor newAggregationCursor(IndexPlan plan, NodeState rootState) {
        Cursor c = baseIndex.query(plan, rootState);
        // we possibly get results from a child,
        // so we need to wrap the cursor to do aggregation
        return new AggregationCursor(c,
                getNodeAggregator(), rootState);        
    }
View Full Code Here

            // if still here then something went wrong.
            throw new IllegalStateException(
                    "OrderedPropertyIndex index is used even when no index is available for filter "
                            + filter);
        }
        Cursor cursor = Cursors.newPathCursor(paths, filter.getQueryEngineSettings());
        if (depth > 1) {
            cursor = Cursors.newAncestorCursor(cursor, depth - 1, filter.getQueryEngineSettings());
        }
        return cursor;
    }
View Full Code Here

        return cost;
    }

    Cursor execute() {
        QueryEngineSettings settings = filter.getQueryEngineSettings();
        Cursor cursor = Cursors.newPathCursor(
                strategy.query(filter, name, definition, values),
                settings);
        if (depth > 1) {
            cursor = Cursors.newAncestorCursor(cursor, depth - 1, settings);
        }
View Full Code Here

        return sb;
    }

    @Override
    public Cursor query(Filter filter, NodeState root) {
        Cursor cursor;
        try {
            SolrQuery query = getQuery(filter);
            QueryResponse queryResponse = solrServer.query(query);
            cursor = new SolrCursor(queryResponse);
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.query.Cursor

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.