Package org.modeshape.jcr.query.model

Examples of org.modeshape.jcr.query.model.FullTextSearch.fullTextSearchExpression()


        assertThat(and.right(), is(instanceOf(FullTextSearch.class)));
        FullTextSearch search = (FullTextSearch)and.right();
        assertThat(search.selectorName(), is(selectorName("tableA")));
        assertThat(search.getPropertyName(), is("p1"));
        assertThat(search.fullTextSearchExpression(), is("term1"));
    }

    @Test
    public void shouldParseConstraintFromStringWithMultipleAndExpressions() {
        NamedSelector selector = new NamedSelector(selectorName("tableA"));
View Full Code Here


        assertThat(secondAnd.left(), is(instanceOf(FullTextSearch.class)));
        FullTextSearch search1 = (FullTextSearch)secondAnd.left();
        assertThat(search1.selectorName(), is(selectorName("tableA")));
        assertThat(search1.getPropertyName(), is("p1"));
        assertThat(search1.fullTextSearchExpression(), is("term1"));

        assertThat(secondAnd.right(), is(instanceOf(FullTextSearch.class)));
        FullTextSearch search2 = (FullTextSearch)secondAnd.right();
        assertThat(search2.selectorName(), is(selectorName("tableA")));
        assertThat(search2.getPropertyName(), is("p2"));
View Full Code Here

        assertThat(secondAnd.right(), is(instanceOf(FullTextSearch.class)));
        FullTextSearch search2 = (FullTextSearch)secondAnd.right();
        assertThat(search2.selectorName(), is(selectorName("tableA")));
        assertThat(search2.getPropertyName(), is("p2"));
        assertThat(search2.fullTextSearchExpression(), is("term2"));
    }

    @Test( expected = ParsingException.class )
    public void shouldFailToParseConstraintFromStringWithAndExpressionWithNoSecondConstraint() {
        NamedSelector selector = new NamedSelector(selectorName("tableA"));
View Full Code Here

        assertThat(or.right(), is(instanceOf(FullTextSearch.class)));
        FullTextSearch search = (FullTextSearch)or.right();
        assertThat(search.selectorName(), is(selectorName("tableA")));
        assertThat(search.getPropertyName(), is("p1"));
        assertThat(search.fullTextSearchExpression(), is("term1"));

    }

    @Test( expected = ParsingException.class )
    public void shouldFailToParseConstraintFromStringWithOrExpressionWithNoSecondConstraint() {
View Full Code Here

        Constraint constraint = parser.parseConstraint(tokens("CONTAINS(propertyA,'term1 term2 -term3')"), typeSystem, selector);
        assertThat(constraint, is(instanceOf(FullTextSearch.class)));
        FullTextSearch search = (FullTextSearch)constraint;
        assertThat(search.selectorName(), is(selectorName("tableA")));
        assertThat(search.getPropertyName(), is("propertyA"));
        assertThat(search.fullTextSearchExpression(), is("term1 term2 -term3"));
    }

    @Test
    public void shouldParseConstraintFromStringWithIsContainsExpressionWithSelectorNameAndProperty() {
        Constraint constraint = parser.parseConstraint(tokens("CONTAINS(tableA.propertyA,'term1 term2 -term3')"),
View Full Code Here

                                                       mock(Source.class));
        assertThat(constraint, is(instanceOf(FullTextSearch.class)));
        FullTextSearch search = (FullTextSearch)constraint;
        assertThat(search.selectorName(), is(selectorName("tableA")));
        assertThat(search.getPropertyName(), is("propertyA"));
        assertThat(search.fullTextSearchExpression(), is("term1 term2 -term3"));
    }

    @Test
    public void shouldParseConstraintFromStringWithIsContainsExpressionWithSelectorNameAndAnyProperty() {
        Constraint constraint = parser.parseConstraint(tokens("CONTAINS(tableA.*,'term1 term2 -term3')"),
View Full Code Here

            FullTextSearch search = (FullTextSearch)constraint;
            if (".".equals(search.getPropertyName())) {
                // JCR-SQL's use of CONTAINS allows a '.' to be used to represent the search is to be
                // performed on all properties of the node(s). However, JCR-SQL2 and our AQM
                // expect a '*' to be used instead ...
                return new FullTextSearch(search.selectorName(), search.fullTextSearchExpression());
            }
        } else if (constraint instanceof And) {
            And and = (And)constraint;
            constraint = new And(rewriteConstraint(and.left()), rewriteConstraint(and.right()));
        } else if (constraint instanceof Or) {
View Full Code Here

        }
        if (constraint instanceof FullTextSearch) {
            FullTextSearch search = (FullTextSearch)constraint;
            SelectorName replacement = rewrittenSelectors.get(search.selectorName());
            if (replacement == null) return search;
            return new FullTextSearch(replacement, search.getPropertyName(), search.fullTextSearchExpression());
        }
        if (constraint instanceof Between) {
            Between between = (Between)constraint;
            DynamicOperand lhs = between.getOperand();
            StaticOperand lower = between.getLowerBound(); // Current only a literal; therefore, no reference to selector
View Full Code Here

            if (sourceColumn == null) {
                if (search.getPropertyName() == null && mapping.getMappedSelectorNames().size() == 1) {
                    SelectorName newSelectorName = mapping.getSingleMappedSelectorName();
                    if (newSelectorName != null) {
                        node.addSelector(newSelectorName);
                        return new FullTextSearch(newSelectorName, search.getPropertyName(), search.fullTextSearchExpression(),
                                                  search.getFullTextSearchExpression());
                    }
                }
                return search;
            }
View Full Code Here

                }
                return search;
            }
            node.addSelector(sourceColumn.selectorName());
            return new FullTextSearch(sourceColumn.selectorName(), sourceColumn.getPropertyName(),
                                      search.fullTextSearchExpression(), search.getFullTextSearchExpression());
        }
        if (constraint instanceof SetCriteria) {
            SetCriteria set = (SetCriteria)constraint;
            DynamicOperand oldLeft = set.leftOperand();
            Set<SelectorName> selectorNames = oldLeft.selectorNames();
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.