Package javax.jcr.query

Examples of javax.jcr.query.QueryResult


        String sql = "SELECT * FROM nt:unstructured"
                + " WHERE \"jcr:path\" LIKE '" + testRoot + "/%"
                + "' AND CONTAINS(., 'fox test')";
        Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL);
        QueryResult result = q.execute();
        checkResult(result, 1);
    }
View Full Code Here


        String sql = "SELECT * FROM nt:unstructured"
                + " WHERE \"jcr:path\" LIKE '" + testRoot + "/%"
                + "' AND CONTAINS(., 'text \"fox jumps\"')";
        Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL);
        QueryResult result = q.execute();
        checkResult(result, 1);
    }
View Full Code Here

        String sql = "SELECT * FROM nt:unstructured"
                + " WHERE \"jcr:path\" LIKE '" + testRoot + "/%"
                + "' AND CONTAINS(., 'text ''fox jumps'' -other')";
        Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL);
        QueryResult result = q.execute();
        checkResult(result, 1);
    }
View Full Code Here

        String sql = "SELECT * FROM nt:unstructured"
                + " WHERE \"jcr:path\" LIKE '" + testRoot + "/%"
                + "' AND CONTAINS(., '''fox jumps'' test OR other')";
        Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL);
        QueryResult result = q.execute();
        checkResult(result, 2);
    }
View Full Code Here

        String sql = "SELECT * FROM nt:unstructured"
                + " WHERE \"jcr:path\" LIKE '" + testRoot + "/%"
                + "' AND CONTAINS(., '''fox juMps'' Test OR otheR')";
        Query q = superuser.getWorkspace().getQueryManager().createQuery(sql, Query.SQL);
        QueryResult result = q.execute();
        checkResult(result, 2);
    }
View Full Code Here

        n.setProperty("prop3", "foo");

        superuser.save();

        List<String> r1 = new ArrayList<String>();
        QueryResult result = qm.createQuery(testPath + "/*[jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r1.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        List<String> r2 = new ArrayList<String>();
        result = qm.createQuery(testPath + "/*[jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo') or jcr:contains(@prop2, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r2.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        List<String> r3 = new ArrayList<String>();
        result = qm.createQuery(testPath + "/*[jcr:contains(@prop2, 'foo') or jcr:contains(@prop3, 'foo') or jcr:contains(@prop1, 'foo')] order by @jcr:score descending", Query.XPATH).execute();
        for (Row r : new RowIterable(result.getRows())) {
            r3.add(r.getPath() + ":" + (int) (r.getScore() * 1000));
        }

        assertEquals(r1, r2);
        assertEquals(r1, r3);
View Full Code Here

     *                             or checking the result.
     */
    protected void executeXPathQuery(String xpath, Node[] nodes)
            throws RepositoryException {
        flushSearchIndex();
        QueryResult res = qm.createQuery(xpath, Query.XPATH).execute();
        checkResult(res, nodes);
    }
View Full Code Here

     *                             or checking the result.
     */
    protected void executeSQLQuery(String sql, Node[] nodes)
            throws RepositoryException {
        flushSearchIndex();
        QueryResult res = qm.createQuery(sql, Query.SQL).execute();
        checkResult(res, nodes);
    }
View Full Code Here

    }

    protected void executeSQL2Query(String statement, Node[] nodes)
            throws RepositoryException {
        flushSearchIndex();
        QueryResult res = qm.createQuery(statement, JCR_SQL2).execute();
        checkResult(res, nodes);
    }
View Full Code Here

        n.setProperty("text", text);
        n.setProperty("other", "foo");
        superuser.save();

        String stmt = getStatement("foo");
        QueryResult result = executeQuery(stmt);
        RowIterator rows = result.getRows();
        assertEquals(1, rows.getSize());
        String ex = rows.nextRow().getValue("rep:excerpt(text)").getString();
        assertEquals("Expected " + excerpt + ", but got ", excerpt, ex);
    }
View Full Code Here

TOP

Related Classes of javax.jcr.query.QueryResult

Copyright © 2018 www.massapicom. 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.