Package javax.jcr.query

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


        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

        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))) */",
                getResult(q.execute(), "plan"));
        q = qm.createQuery(sql2, Query.JCR_SQL2);
        // assertEquals("/testroot",
        //        getResult(q.execute(), "path"));           
       
    }
   
View Full Code Here

     */
    private RowIterator execute() {
        try {
            String stmt = translateStatement();
            QueryManager qm = session.getWorkspace().getQueryManager();
            RowIterator nodes = qm.createQuery(stmt, Query.XPATH).execute().getRows();
            if (filter != null) {
                nodes = new FilteredRowIterator(nodes);
            }
            if (offset > 0) {
                try {
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.