Package javax.jcr.query

Examples of javax.jcr.query.QueryManager.createQuery()


        stmt.append("]");
       
        QueryResult result;
        try {
            QueryManager qm = session.getWorkspace().getQueryManager();
            Query q = qm.createQuery(stmt.toString(), Query.XPATH);
            result = q.execute();
        } catch (RepositoryException e) {
            log.error("Unexpected error while searching effective policies.", e.getMessage());           
            throw new UnsupportedOperationException("Retrieve effective policies for set of principals not supported.", e);
        }
View Full Code Here


                for (Map.Entry<String, String> entry : namespaces.entrySet()) {
                    String prefix = entry.getKey();
                    String uri = entry.getValue();
                    session.setNamespacePrefix(prefix, uri);
                }
                q = qMgr.createQuery(sInfo.getQuery(), sInfo.getLanguageName());

                if (SearchInfo.NRESULTS_UNDEFINED != sInfo.getNumberResults()) {
                    q.setLimit(sInfo.getNumberResults());
                }
                if (SearchInfo.OFFSET_UNDEFINED != sInfo.getOffset()) {
View Full Code Here

        String sql2 = "select [jcr:path] as [path] from [nt:base] " +
                "where contains([text], 'hello OR hallo') order by [jcr:path]";
       
        Query q;
       
        q = qm.createQuery("explain " + sql2, Query.JCR_SQL2);

// TODO the plan should actually be:
//            assertEquals("[nt:base] as [nt:base] /* " +
//                    "+((text:hallo text:hello)~1) +text:{* TO *} " +
//                    "ft:(text:\"hallo\" OR text:\"hello\") " +
View Full Code Here

                getResult(q.execute(), "plan"));
  
        // lowercase "or" mean search for the term "or"
        sql2 = "select [jcr:path] as [path] from [nt:base] " +
                "where contains([text], 'hello or hallo') order by [jcr:path]";
        q = qm.createQuery(sql2, Query.JCR_SQL2);
        assertEquals("",
                getResult(q.execute(), "path"));

    }
   
View Full Code Here

        String sql2 = "select [jcr:path] as [path] from [nt:base] " +
                "where ISCHILDNODE([/testroot])" +
                " AND CONTAINS(text, 'hallo')";

        q = qm.createQuery("explain " + sql2, Query.JCR_SQL2);
        // TODO the plan should actually be:
//          assertEquals("[nt:base] as [nt:base] /* " +
//                  "+text:hallo +:path:/testroot/* +text:{* TO *} " +
//                  "ft:(text:\"hallo\") " +
//                  "where (ischildnode([nt:base], [/testroot])) " +
View Full Code Here

                "ft:(text:\"hallo\") " +
                "where (ischildnode([nt:base], [/testroot])) " +
                "and (contains([nt:base].[text], cast('hallo' as string))) */",
                getResult(q.execute(), "plan"));
       
        q = qm.createQuery(sql2, Query.JCR_SQL2);
        assertEquals("/testroot/node2, /testroot/node3", getResult(q.execute(), "path"));
      
        sql2 = "select [jcr:path] as [path] from [nt:base] " +
                "where contains([node1/text], 'hello') order by [jcr:path]";
       
View Full Code Here

//            "ft:(text:\"hallo\") " +
//            "where (ischildnode([nt:base], [/testroot])) " +
//            "and (contains([nt:base].[text], cast('hallo' as string))) */",
//            getResult(q.execute(), "plan"));

        q = qm.createQuery(sql2, Query.JCR_SQL2);
        assertEquals("/testroot", getResult(q.execute(), "path"));
       
        sql2 = "select [jcr:path] as [path] from [nt:base] " +
                "where contains([node2/text], 'hello OR hallo') order by [jcr:path]";
        q = qm.createQuery("explain " + sql2, Query.JCR_SQL2);
View Full Code Here

        q = qm.createQuery(sql2, Query.JCR_SQL2);
        assertEquals("/testroot", getResult(q.execute(), "path"));
       
        sql2 = "select [jcr:path] as [path] from [nt:base] " +
                "where contains([node2/text], 'hello OR hallo') order by [jcr:path]";
        q = qm.createQuery("explain " + sql2, Query.JCR_SQL2);
        // TODO the plan should actually be:
//            assertEquals("[nt:base] as [nt:base] /* " +
//                    "(text:hallo text:hello)~1 " +
//                    "ft:(node2/text:\"hallo\" OR node2/text:\"hello\") " +
//                    "parent:node2 " +
View Full Code Here

                "aggregate :fulltext:hallo* :fulltext:hello* " +
                "ft:(node2/text:\"hallo\" OR node2/text:\"hello\") " +
                "parent:node2 " +
                "where contains([nt:base].[node2/text], cast('hello OR hallo' as string)) */",
      getResult(q.execute(), "plan"));
        q = qm.createQuery(sql2, Query.JCR_SQL2);
        assertEquals("/testroot",
                getResult(q.execute(), "path"));           
       
        sql2 = "select [jcr:path] as [path] from [nt:base] " +
                "where contains([node1/text], 'hello') " +
View Full Code Here

       
        sql2 = "select [jcr:path] as [path] from [nt:base] " +
                "where contains([node1/text], 'hello') " +
                "and contains([node2/text], 'hallo') " +
                "order by [jcr:path]";
        q = qm.createQuery("explain " + sql2, Query.JCR_SQL2);
        // TODO OAK-890
        assertEquals("[nt:base] as [nt:base] /* " +
                "aggregate Not yet implemented " +
                "where (contains([nt:base].[node1/text], cast('hello' as string))) " +
                "and (contains([nt:base].[node2/text], cast('hallo' as string))) */",
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.