Package org.apache.jackrabbit.oak.query.index

Examples of org.apache.jackrabbit.oak.query.index.FilterImpl


        Tree tree = root.getTree("/");
        tree.addChild("somenode").setProperty("foo", "bar");
        root.commit();

        QueryIndex index = new SolrQueryIndex("solr", server, configuration);
        FilterImpl filter = new FilterImpl(null, null);
        filter.restrictPath("/somenode", Filter.PathRestriction.EXACT);
        filter.restrictProperty("foo", Operator.EQUAL, PropertyValues.newString("bar"));
        Cursor cursor = index.query(filter, store.getRoot());
        assertNotNull(cursor);
        assertTrue(cursor.hasNext());
        assertEquals("/somenode", cursor.next().getPath());
        assertFalse(cursor.hasNext());
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.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();
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"));
        Cursor cursor = queryIndex.query(filter, indexed);
        assertNotNull(cursor);
        assertTrue("no results found", cursor.hasNext());
        IndexRow next = cursor.next();
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

        store.merge(root, new EditorHook(new IndexUpdateProvider(
                new PropertyIndexEditorProvider())), null);

        NodeState rootState = store.getRoot();
        NodeTypeIndex index = new NodeTypeIndex();
        FilterImpl filter;

        filter = createFilter(rootState, JcrConstants.NT_FOLDER);
        assertEquals(2.0, index.getCost(filter, rootState), 0.0);
        checkCursor(index.query(filter, rootState), "/folder-1", "/folder-2");
View Full Code Here

    private static FilterImpl createFilter(NodeState root, String nodeTypeName) {
        NodeState system = root.getChildNode(JCR_SYSTEM);
        NodeState types = system.getChildNode(JCR_NODE_TYPES);
        NodeState type = types.getChildNode(nodeTypeName);
        SelectorImpl selector = new SelectorImpl(type, nodeTypeName);
        return new FilterImpl(selector, "SELECT * FROM [" + nodeTypeName + "]");
    }
View Full Code Here

            String value) {
        NodeState system = root.getChildNode(JCR_SYSTEM);
        NodeState types = system.getChildNode(JCR_NODE_TYPES);
        NodeState type = types.getChildNode(NT_BASE);
        SelectorImpl selector = new SelectorImpl(type, NT_BASE);
        Filter filter = new FilterImpl(selector, "SELECT * FROM [nt:base]");
        return Sets.newHashSet(lookup.query(filter, name,
                PropertyValues.newString(value)));
    }
View Full Code Here

        }
        NodeState after = builder.getNodeState();

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

        FilterImpl f = createFilter(indexed, NT_BASE);

        // Query the index
        PropertyIndexLookup lookup = new PropertyIndexLookup(indexed);
        double cost;
       
View Full Code Here

            c.setProperty("foo", "azerty");
        }
        NodeState after = builder.getNodeState();
        NodeState indexed = HOOK.processCommit(before, after);

        FilterImpl f = createFilter(indexed, NT_BASE);

        PropertyIndexLookup lookup = new PropertyIndexLookup(indexed);
        double cost = lookup.getCost(f, "foo",
                PropertyValues.newString("azerty"));
        double traversal = new TraversingIndex().getCost(f, indexed);
View Full Code Here

        }
        NodeState after = builder.getNodeState();

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

        FilterImpl f = createFilter(indexed, NT_BASE);

        // Query the index
        PropertyIndexLookup lookup = new PropertyIndexLookup(indexed);
        assertEquals(ImmutableSet.of("a", "b"), find(lookup, "foo", "abc", f));
        assertEquals(ImmutableSet.of("b"), find(lookup, "foo", "def", f));
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.query.index.FilterImpl

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.