Examples of QueryIndex


Examples of org.apache.jackrabbit.oak.spi.QueryIndex

        if (mk != this.mk) {
            return Collections.emptyList();
        }
        ArrayList<QueryIndex> list = new ArrayList<QueryIndex>();
        for (Index index : indexes.values()) {
            QueryIndex qi = null;
            if (index instanceof PropertyIndex) {
                qi = new PropertyContentIndex(mk, (PropertyIndex) index);
            } else if (index instanceof PrefixIndex) {
                // TODO support prefix indexes?
            }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.QueryIndex

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

    public QueryIndex getBestIndex(FilterImpl filter) {
        QueryIndex best = null;
        double bestCost = Double.MAX_VALUE;
        for (QueryIndex index : getIndexes()) {
            double cost = index.getCost(filter);
            if (cost < bestCost) {
                best = index;
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.QueryIndex

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

    public QueryIndex getBestIndex(FilterImpl filter) {
        QueryIndex best = null;
        double bestCost = Double.MAX_VALUE;
        for (QueryIndex index : getIndexes()) {
            double cost = index.getCost(filter);
            if (cost < bestCost) {
                best = index;
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.QueryIndex

        Tree tree = root.getTree("/");

        tree.setProperty("foo", MemoryValueFactory.INSTANCE.createValue("bar"));
        root.commit(DefaultConflictHandler.OURS);

        QueryIndex index = new LuceneIndex(store, "jcr:system", "oak:lucene");
        FilterImpl filter = new FilterImpl(null);
        filter.restrictPath("/", Filter.PathRestriction.EXACT);
        filter.restrictProperty(
                "foo",
                Operator.EQUAL,
                MemoryValueFactory.INSTANCE.createValue("bar"));
        Cursor cursor = index.query(filter, null);
        assertTrue(cursor.next());
        assertEquals("/", cursor.currentPath());
        assertFalse(cursor.next());
    }
View Full Code Here

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

                context.getIndexProvider(), traversalFallback);
    }

    private static QueryIndex getBestIndex(NodeState rootState, Filter filter,
            QueryIndexProvider indexProvider, boolean traversalFallback) {
        QueryIndex best = null;
        if (LOG.isDebugEnabled()) {
            LOG.debug("cost using filter " + filter);
        }

        double bestCost = Double.POSITIVE_INFINITY;
View Full Code Here

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

        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

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

        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

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

        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

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

    protected void setTravesalFallback(boolean traversal) {
        this.traversalFallback = traversal;
    }

    public QueryIndex getBestIndex(QueryImpl query, NodeState rootState, Filter filter) {
        QueryIndex best = null;
        if (LOG.isDebugEnabled()) {
            LOG.debug("cost using filter " + filter);
        }
        List<QueryIndex> indexes = new ArrayList<QueryIndex>(
                indexProvider.getQueryIndexes(rootState));
View Full Code Here

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

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

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

        QueryIndex queryIndex = new LuceneIndex(analyzer, null);
        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
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.