protected FullTextSearch fullTextSearch( SelectorName name, String propertyName, StaticOperand expression ) throws RepositoryException { return new FullTextSearch(name, propertyName, expression, null); }
protected FullTextSearch fullTextSearch( SelectorName name, String propertyName, StaticOperand expression ) throws RepositoryException { return new FullTextSearch(name, propertyName, expression, null); }
protected FullTextSearch fullTextSearch( SelectorName name, String propertyName, String expression, Term term ) { return new FullTextSearch(name, propertyName, expression, term); }
protected FullTextSearch fullTextSearch( SelectorName name, String propertyName, String expression, Term term ) { return new FullTextSearch(name, propertyName, expression, term); }
public FullTextSearch withFullTextExpression( String expression ) { return new FullTextSearch(selectorName, propertyName, expression); }
public FullTextSearch withFullTextExpression( String expression ) { return new FullTextSearch(selectorName, propertyName, expression); }
/** * Define a constraint clause that the node within the named table have at least one property that satisfies the full-text * search expression. * * @param table the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the * FROM clause * @param searchExpression the full-text search expression * @return the constraint builder that was used to create this clause; never null */ public ConstraintBuilder search( String table, String searchExpression ) { return setConstraint(new FullTextSearch(selector(table), searchExpression)); }
/** * Define a constraint clause that the node within the named table have at least one property that satisfies the full-text * search expression. * * @param table the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the * FROM clause * @param searchExpression the full-text search expression * @return the constraint builder that was used to create this clause; never null */ public ConstraintBuilder search( String table, String searchExpression ) { return setConstraint(new FullTextSearch(selector(table), searchExpression)); }
/** * Define a constraint clause that the node within the named table have a value for the named property that satisfies the * full-text search expression. * * @param table the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the * FROM clause * @param propertyName the name of the property to be searched * @param searchExpression the full-text search expression * @return the constraint builder that was used to create this clause; never null */ public ConstraintBuilder search( String table, String propertyName, String searchExpression ) { return setConstraint(new FullTextSearch(selector(table), propertyName, searchExpression)); }
/** * Define a constraint clause that the node within the named table have a value for the named property that satisfies the * full-text search expression. * * @param table the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the * FROM clause * @param propertyName the name of the property to be searched * @param searchExpression the full-text search expression * @return the constraint builder that was used to create this clause; never null */ public ConstraintBuilder search( String table, String propertyName, String searchExpression ) { return setConstraint(new FullTextSearch(selector(table), propertyName, searchExpression)); }
@Override public FullTextSearch fullTextSearch( String selectorName, String propertyName, javax.jcr.query.qom.StaticOperand fullTextSearchExpression ) throws RepositoryException { CheckArg.isNotNull(selectorName, "selectorName"); StaticOperand expression = CheckArg.getInstanceOf(fullTextSearchExpression, StaticOperand.class, "fullTextSearchExpression"); return new FullTextSearch(selectorName(selectorName), propertyName, expression, null); }
@Override public FullTextSearch fullTextSearch( String selectorName, String propertyName, javax.jcr.query.qom.StaticOperand fullTextSearchExpression ) throws RepositoryException { CheckArg.isNotNull(selectorName, "selectorName"); StaticOperand expression = CheckArg.getInstanceOf(fullTextSearchExpression, StaticOperand.class, "fullTextSearchExpression"); return new FullTextSearch(selectorName(selectorName), propertyName, expression, null); }
@Override public QueryCommand parseQuery( String query, TypeSystem typeSystem ) throws InvalidQueryException { // Parse the terms ... try { PARSER.parse(query); } catch (ParsingException e) { throw new InvalidQueryException(query, e.getMessage()); } // Now create a query that represents this full-text search ... Constraint constraint = new FullTextSearch(FULL_TEXT_SELECTOR_NAME, query); return new SelectQuery(FULL_TEXT_SOURCE, constraint, FULL_TEXT_ORDERING, FULL_TEXT_COLUMNS, Limit.NONE, FULL_TEXT_DISTINCT); }
@Override public QueryCommand parseQuery( String query, TypeSystem typeSystem ) throws InvalidQueryException { // Parse the terms ... try { PARSER.parse(query); } catch (ParsingException e) { throw new InvalidQueryException(query, e.getMessage()); } // Now create a query that represents this full-text search ... Constraint constraint = new FullTextSearch(FULL_TEXT_SELECTOR_NAME, query); return new SelectQuery(FULL_TEXT_SOURCE, constraint, FULL_TEXT_ORDERING, FULL_TEXT_COLUMNS, Limit.NONE, FULL_TEXT_DISTINCT); }
private FullTextSearch fullTextSearch(String query) { return new FullTextSearch(new SelectorName("test"), query); }
@Test public void shouldConstructReadableStringWithLiteralFullTextSearch() { source = new NamedSelector(selector("nt:unstructured")); columns = Collections.singletonList(new Column(selector("selector1"))); constraint = new FullTextSearch(selector("selector1"), "someProperty", "this OR that"); orderings = Collections.emptyList(); query = new Query(source, constraint, orderings, columns, limits, distinct); assertThat(Visitors.readable(query), is("SELECT selector1.* FROM [nt:unstructured] WHERE CONTAINS(selector1.someProperty,'this OR that')")); }
@Test public void shouldConstructReadableStringWithVariableFullTextSearch() throws RepositoryException { source = new NamedSelector(selector("nt:unstructured")); columns = Collections.singletonList(new Column(selector("selector1"))); constraint = new FullTextSearch(selector("selector1"), "someProperty", new BindVariableName("matchVar"), null); orderings = Collections.emptyList(); query = new Query(source, constraint, orderings, columns, limits, distinct); assertThat(Visitors.readable(query), is("SELECT selector1.* FROM [nt:unstructured] WHERE CONTAINS(selector1.someProperty,$matchVar)")); } }
@Test public void shouldOptimizePlanForQueryUsingTypeView() { node = optimize("SELECT type1.a1 AS a, type1.a2 AS b FROM type1 WHERE CONTAINS(type1.a2,'something')"); // Create the expected plan ... PlanNode access = new PlanNode(Type.ACCESS, selector("type1")); PlanNode project = new PlanNode(Type.PROJECT, access, selector("type1")); project.setProperty(Property.PROJECT_COLUMNS, columns(column("type1", "a1", "a"), column("type1", "a2", "b"))); PlanNode select1 = new PlanNode(Type.SELECT, project, selector("type1")); select1.setProperty(Property.SELECT_CRITERIA, new FullTextSearch(selector("type1"), "a2", "something")); PlanNode select2 = new PlanNode(Type.SELECT, select1, selector("type1")); select2.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "primaryType"), new Literal("t1"), new Literal("t0"))); PlanNode select3 = new PlanNode(Type.SELECT, select2, selector("type1")); select3.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "mixins"), new Literal("t3"), new Literal("t4"))); PlanNode source = new PlanNode(Type.SOURCE, select3, selector("type1")); source.setProperty(Property.SOURCE_NAME, selector("all")); source.setProperty(Property.SOURCE_ALIAS, selector("type1")); source.setProperty(Property.SOURCE_COLUMNS, context.getSchemata().getTable(selector("all")).getColumns()); // Compare the expected and actual plan ... assertPlanMatches(access); }
column("type1", "a4", "d"))); PlanNode select1 = new PlanNode(Type.SELECT, project, selector("type1")); select1.setProperty(Property.SELECT_CRITERIA, new FullTextSearch(selector("type1"), "a2", "something")); PlanNode select2 = new PlanNode(Type.SELECT, select1, selector("type1")); select2.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "primaryType"),
column("type1", "a4", "d"))); PlanNode select1 = new PlanNode(Type.SELECT, project, selector("type1")); select1.setProperty(Property.SELECT_CRITERIA, new FullTextSearch(selector("type1"), "a2", "something")); PlanNode select2 = new PlanNode(Type.SELECT, select1, selector("type1")); select2.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "primaryType"),