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

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


     * @param preparing whether a filter for the prepare phase should be made
     * @return the filter
     */
    @Override
    public Filter createFilter(boolean preparing) {
        FilterImpl f = new FilterImpl(this, query.getStatement());
        f.setPreparing(preparing);
        if (joinCondition != null) {
            joinCondition.restrict(f);
        }
        // rep:excerpt handling: create a (fake) restriction
        // "rep:excerpt is not null" to let the index know that
        // we will need the excerpt
        for (ColumnImpl c : query.getColumns()) {
            if (c.getSelector() == this) {
                if (c.getColumnName().equals("rep:excerpt")) {
                    f.restrictProperty("rep:excerpt", Operator.NOT_EQUAL, null);
                }
            }
        }
       
        // all conditions can be pushed to the selectors -
        // except in some cases to "outer joined" selectors,
        // but the exceptions are handled in the condition
        // itself.
        // An example where it *is* a problem:
        //  "select * from a left outer join b on a.x = b.y
        // where b.y is null" - in this case the selector b
        // must not use an index condition on "y is null"
        // (".. is null" must be written as "not .. is not null").
        if (queryConstraint != null) {
            queryConstraint.restrict(f);
            FullTextExpression ft = queryConstraint.getFullTextConstraint(this);
            f.setFullTextConstraint(ft);
        }

        return f;
    }
View Full Code Here


        NodeState indexRoot = root.getChildNode(INDEX_DEFINITIONS_NAME)
                .getChildNode(NAME);
        if (!indexRoot.exists()) {
            return newPathCursor(new ArrayList<String>());
        }
        Iterable<String> paths = STORE.query(new FilterImpl(), index + "("
                + uuid + ")", indexRoot, index, ImmutableSet.of(uuid));

        if (!"*".equals(name)) {
            paths = filter(paths, new Predicate<String>() {
                @Override
View Full Code Here

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

        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 + "]", null);
    }
View Full Code Here

                newAggregationFilter(filter), rootState),
                baseIndex.getNodeAggregator(), rootState);
    }

    private static Filter newAggregationFilter(Filter filter) {
        FilterImpl f = new FilterImpl(filter);
        // disables node type checks for now
        f.setMatchesAllTypes(true);

        // TODO OAK-828
        // FullTextExpression constraint = filter.getFullTextConstraint();
        // constraint = getFlatConstraint(constraint);
        // f.setFullTextConstraint(constraint);
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

     *
     * @param preparing whether a filter for the prepare phase should be made
     * @return the filter
     */
    private Filter createFilter(boolean preparing) {
        FilterImpl f = new FilterImpl(this, query.getStatement(), query.getRootTree());
        f.setPreparing(preparing);
        if (joinCondition != null) {
            joinCondition.restrict(f);
        }
        // rep:excerpt handling: create a (fake) restriction
        // "rep:excerpt is not null" to let the index know that
        // we will need the excerpt
        for (ColumnImpl c : query.getColumns()) {
            if (c.getSelector() == this) {
                if (c.getColumnName().equals("rep:excerpt")) {
                    f.restrictProperty("rep:excerpt", Operator.NOT_EQUAL, null);
                }
            }
        }
       
        // all conditions can be pushed to the selectors -
        // except in some cases to "outer joined" selectors,
        // but the exceptions are handled in the condition
        // itself.
        // An example where it *is* a problem:
        //  "select * from a left outer join b on a.x = b.y
        // where b.y is null" - in this case the selector b
        // must not use an index condition on "y is null"
        // (".. is null" must be written as "not .. is not null").
        if (queryConstraint != null) {
            queryConstraint.restrict(f);
            FullTextExpression ft = queryConstraint.getFullTextConstraint(this);
            f.setFullTextConstraint(ft);
        }

        return f;
    }
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]", null);
        return Sets.newHashSet(lookup.query(filter, name,
                PropertyValues.newString(value)));
    }
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.