Examples of restrictPath()


Examples of org.apache.jackrabbit.oak.query.index.FilterImpl.restrictPath()

        SolrServer solrServer = mock(SolrServer.class);
        OakSolrConfiguration configuration = new DefaultSolrConfiguration();
        SolrQueryIndex solrQueryIndex = new SolrQueryIndex("solr", solrServer, configuration);

        FilterImpl filter = new FilterImpl(selector, "select * from [nt:base] as a where isdescendantnode(a, '/test')", new QueryEngineSettings());
        filter.restrictPath("/test", Filter.PathRestriction.ALL_CHILDREN);
        double cost = solrQueryIndex.getCost(filter, root);
        assertTrue(Double.POSITIVE_INFINITY == cost);
    }

    @Test
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.index.FilterImpl.restrictPath()

            }
        };
        SolrQueryIndex solrQueryIndex = new SolrQueryIndex("solr", solrServer, configuration);

        FilterImpl filter = new FilterImpl(selector, "select * from [nt:base] as a where isdescendantnode(a, '/test')", new QueryEngineSettings());
        filter.restrictPath("/test", Filter.PathRestriction.ALL_CHILDREN);
        double cost = solrQueryIndex.getCost(filter, root);
        assertTrue(10 == cost);
    }

    @Test
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.index.FilterImpl.restrictPath()

        newLuceneIndexDefinition(index, "l1", of(TYPENAME_STRING));
        newLuceneIndexDefinition(index, "l2", of(TYPENAME_STRING));

        LuceneIndexLookup lookup = new LuceneIndexLookup(builder.getNodeState());
        FilterImpl f = new FilterImpl();
        f.restrictPath("/", Filter.PathRestriction.EXACT);
        assertEquals(of("/oak:index/l1", "/oak:index/l2"),
                lookup.collectIndexNodePaths(f));
    }

    @Test
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.index.FilterImpl.restrictPath()

        index = builder.child("a").child("b").child(INDEX_DEFINITIONS_NAME);
        newLuceneIndexDefinition(index, "l3", of(TYPENAME_STRING));

        LuceneIndexLookup lookup = new LuceneIndexLookup(builder.getNodeState());
        FilterImpl f = new FilterImpl();
        f.restrictPath("/a", Filter.PathRestriction.EXACT);
        assertEquals(of("/oak:index/l1", "/a/oak:index/l2"),
                lookup.collectIndexNodePaths(f));

        f.restrictPath("/a/b", Filter.PathRestriction.EXACT);
        assertEquals(of("/oak:index/l1", "/a/oak:index/l2", "/a/b/oak:index/l3"),
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.index.FilterImpl.restrictPath()

        FilterImpl f = new FilterImpl();
        f.restrictPath("/a", Filter.PathRestriction.EXACT);
        assertEquals(of("/oak:index/l1", "/a/oak:index/l2"),
                lookup.collectIndexNodePaths(f));

        f.restrictPath("/a/b", Filter.PathRestriction.EXACT);
        assertEquals(of("/oak:index/l1", "/a/oak:index/l2", "/a/b/oak:index/l3"),
                lookup.collectIndexNodePaths(f));
    }
}
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.index.FilterImpl.restrictPath()

        IndexTracker tracker = new IndexTracker();
        tracker.update(indexed);
        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());
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.index.FilterImpl.restrictPath()


    private void assertQuery(IndexTracker tracker, NodeState indexed, String key, String value){
        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());
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.index.FilterImpl.restrictPath()

        tree.addChild("someothernode");
        root.commit();

        QueryIndex index = new SolrQueryIndex("solr", server, configuration);
        FilterImpl filter = new FilterImpl(mock(SelectorImpl.class), "");
        filter.restrictPath("/somenode", Filter.PathRestriction.EXACT);
        Cursor cursor = index.query(filter, store.getRoot());
        assertNotNull(cursor);
        assertTrue(cursor.hasNext());
        assertEquals("/somenode", cursor.next().getPath());
        assertFalse(cursor.hasNext());
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.index.FilterImpl.restrictPath()

        someothernode.addChild("someotherchild");
        root.commit();

        QueryIndex index = new SolrQueryIndex("solr", server, configuration);
        FilterImpl filter = new FilterImpl(mock(SelectorImpl.class), "");
        filter.restrictPath("/somenode", Filter.PathRestriction.DIRECT_CHILDREN);
        Cursor cursor = index.query(filter, store.getRoot());
        assertNotNull(cursor);
        assertTrue(cursor.hasNext());
        assertEquals("/somenode/child1", cursor.next().getPath());
        assertTrue(cursor.hasNext());
View Full Code Here

Examples of org.apache.jackrabbit.oak.query.index.FilterImpl.restrictPath()

        someothernode.addChild("someotherchild");
        root.commit();

        QueryIndex index = new SolrQueryIndex("solr", server, configuration);
        FilterImpl filter = new FilterImpl(mock(SelectorImpl.class), "");
        filter.restrictPath("/somenode", Filter.PathRestriction.ALL_CHILDREN);
        Cursor cursor = index.query(filter, store.getRoot());
        assertNotNull(cursor);
        assertTrue(cursor.hasNext());
        assertEquals("/somenode", cursor.next().getPath());
        assertTrue(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.