@Test @FixFor( "MODE-2579" ) public void shouldRunFTSQueryWithMultivaluedProperty() throws Exception { Node testRoot = session.getRootNode().addNode("ftsMVP", "nt:unstructured"); Node node1 = testRoot.addNode("node1"); node1.addMixin("mix:title"); node1.setProperty("FTSProp", new String[] {"the quick", "brown fox", "jumps over"}); Node node2 = testRoot.addNode("node2"); node2.addMixin("mix:title"); node2.setProperty("FTSProp", "the quick brown fox jumps over"); session.save(); try { String sql = "SELECT node.[jcr:path] FROM [mix:title] as node WHERE contains(node.*, 'fox')"; Query query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); QueryResult result = query.execute(); validateQuery().rowCount(2).hasNodesAtPaths(node1.getPath(), node2.getPath()).validate(query, result); sql = "SELECT node.[jcr:path] FROM [mix:title] as node WHERE contains(FTSProp, 'the')"; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); result = query.execute(); validateQuery().rowCount(2).hasNodesAtPaths(node1.getPath(), node2.getPath()).validate(query, result); sql = "SELECT node.[jcr:path] FROM [mix:title] as node WHERE contains(node.FTSProp, 'jumps')"; query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); result = query.execute(); validateQuery().rowCount(2).hasNodesAtPaths(node1.getPath(), node2.getPath()).validate(query, result); } finally { testRoot.remove(); session.save(); } }
@Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); @Override org.modeshape.jcr.api.query.qom.QueryObjectModelFactory getQOMFactory(); @Override org.modeshape.jcr.api.query.Query createQuery( String statement,
                                                          String language ); @Override org.modeshape.jcr.api.query.Query createQuery( String statement, 
                                                          String language,
                                                          Locale locale ); org.modeshape.jcr.api.query.Query createQuery( String expression,
                                                          String language,
                                                          Path storedAtPath, 
                                                          Locale locale ); Query createQuery( QueryCommand command ); @Override org.modeshape.jcr.api.query.Query getQuery( Node node ); @Override String[] getSupportedQueryLanguages(); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); @Override org.modeshape.jcr.api.query.qom.QueryObjectModelFactory getQOMFactory(); @Override org.modeshape.jcr.api.query.Query createQuery( String statement,
                                                          String language ); @Override org.modeshape.jcr.api.query.Query createQuery( String statement, 
                                                          String language,
                                                          Locale locale ); org.modeshape.jcr.api.query.Query createQuery( String expression,
                                                          String language,
                                                          Path storedAtPath, 
                                                          Locale locale ); Query createQuery( QueryCommand command ); @Override org.modeshape.jcr.api.query.Query getQuery( Node node ); @Override String[] getSupportedQueryLanguages();  }