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

Examples of org.apache.jackrabbit.oak.spi.query.QueryIndex$IndexPlan


        NodeState after = builder.getNodeState();

        NodeState indexed = hook.processCommit(before, after, CommitInfo.EMPTY);

        QueryIndex queryIndex = new SolrQueryIndex("solr", server, configuration);
        FilterImpl filter = new FilterImpl(mock(SelectorImpl.class), "");
        filter.restrictProperty("foo", Operator.EQUAL,
                PropertyValues.newString("bar"));
        filter.restrictFulltextCondition("bar");
        Cursor cursor = queryIndex.query(filter, indexed);

        Set<String> paths = newHashSet();
        while (cursor.hasNext()) {
            paths.add(cursor.next().getPath());
        }
View Full Code Here


    @Override @Nonnull
    public List<? extends QueryIndex> getQueryIndexes(NodeState state) {
        List<? extends QueryIndex> list = baseProvider.getQueryIndexes(state);
        ArrayList<AggregateIndex> aggregateList = new ArrayList<AggregateIndex>();
        for (int i = 0; i < list.size(); i++) {
            QueryIndex index = list.get(i);
            if (index instanceof FulltextQueryIndex) {
                aggregateList
                        .add(new AggregateIndex((FulltextQueryIndex) index));
            }
        }
View Full Code Here

        NodeState after = builder.getNodeState();

        EditorDiff.process(new LuceneIndexEditor(builder), before, after);
        NodeState indexed = builder.getNodeState();

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

        NodeState after = builder.getNodeState();

        EditorDiff.process(new LuceneIndexEditor(builder), before, after);
        NodeState indexed = builder.getNodeState();

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

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

        NodeState after = builder.getNodeState();

        EditorDiff.process(new LuceneIndexEditor(builder), before, after);
        NodeState indexed = builder.getNodeState();

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

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

        q.prepare();
        return q.executeQuery();
    }

    public QueryIndex getBestIndex(Query query, NodeState rootState, Filter filter) {
        QueryIndex best = null;
        if (LOG.isDebugEnabled()) {
            LOG.debug("cost using filter " + filter);
        }
        double bestCost = Double.POSITIVE_INFINITY;
        for (QueryIndex index : getIndexes(rootState)) {
            double cost = index.getCost(filter, rootState);
            if (LOG.isDebugEnabled()) {
                LOG.debug("cost for " + index.getIndexName() + " is " + cost);
            }
            if (cost < bestCost) {
                bestCost = cost;
                best = index;
            }
        }
        QueryIndex index = new TraversingIndex();
        double cost = index.getCost(filter, rootState);
        if (LOG.isDebugEnabled()) {
            LOG.debug("cost for " + index.getIndexName() + " is " + cost);
        }
        if (cost < bestCost) {
            bestCost = cost;
            best = index;
        }
View Full Code Here

        builder.child("newnode").setProperty("prop", "val");
        NodeState after = builder.getNodeState();

        NodeState indexed = hook.processCommit(before, after);

        QueryIndex queryIndex = new SolrQueryIndex("solr", server, configuration);
        FilterImpl filter = new FilterImpl(null, null);
        filter.restrictPath("/newnode", Filter.PathRestriction.EXACT);
        filter.restrictProperty("prop", Operator.EQUAL,
                PropertyValues.newString("val"));
        Cursor cursor = queryIndex.query(filter, indexed);
        assertNotNull(cursor);
        assertTrue("no results found", cursor.hasNext());
        IndexRow next = cursor.next();
        assertNotNull("first returned item should not be null", next);
        assertEquals("/newnode", next.getPath());
View Full Code Here

        builder.setProperty("foo", "bar");
        NodeState after = builder.getNodeState();

        NodeState indexed = hook.processCommit(before, after);

        QueryIndex queryIndex = new SolrQueryIndex("solr", server, configuration);
        FilterImpl filter = new FilterImpl(null, null);
        filter.restrictProperty("foo", Operator.EQUAL,
                PropertyValues.newString("bar"));
        Cursor cursor = queryIndex.query(filter, indexed);
        assertNotNull(cursor);
        assertTrue("no results found", cursor.hasNext());
        IndexRow next = cursor.next();
        assertNotNull("first returned item should not be null", next);
        assertEquals("/", next.getPath());
View Full Code Here

        NodeState after = builder.getNodeState();

        NodeState indexed = hook.processCommit(before, after);

        QueryIndex queryIndex = new SolrQueryIndex("solr", server, configuration);
        FilterImpl filter = new FilterImpl(null, null);
        filter.restrictProperty("foo", Operator.EQUAL,
                PropertyValues.newString("bar"));
        filter.restrictFulltextCondition("bar");
        Cursor cursor = queryIndex.query(filter, indexed);

        Set<String> paths = newHashSet();
        while (cursor.hasNext()) {
            paths.add(cursor.next().getPath());
        }
View Full Code Here

        q.prepare();
        return q.executeQuery();
    }

    public QueryIndex getBestIndex(Query query, NodeState rootState, Filter filter) {
        QueryIndex best = null;
        if (LOG.isDebugEnabled()) {
            LOG.debug("cost using filter " + filter);
        }
        double bestCost = Double.POSITIVE_INFINITY;
        for (QueryIndex index : getIndexes(rootState)) {
            double cost = index.getCost(filter, rootState);
            if (LOG.isDebugEnabled()) {
                LOG.debug("cost for " + index.getIndexName() + " is " + cost);
            }
            if (cost < bestCost) {
                bestCost = cost;
                best = index;
            }
        }
        QueryIndex index = new TraversingIndex();
        double cost = index.getCost(filter, rootState);
        if (LOG.isDebugEnabled()) {
            LOG.debug("cost for " + index.getIndexName() + " is " + cost);
        }
        if (cost < bestCost) {
            bestCost = cost;
            best = index;
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.query.QueryIndex$IndexPlan

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.