use of javax.jcr.query.Query in project jackrabbit by apache.
the class QueryTest method testSQL2Join.
/**
* https://issues.apache.org/jira/browse/JCR-3089
*/
public void testSQL2Join() throws Exception {
// he query is not supposed to return anything, it will just check that
// the back and forth between the client and the server works
Query q = qm.createQuery("SELECT * FROM [nt:unstructured] AS a INNER JOIN [nt:unstructured] AS b ON b.[refid] = a.[jcr:uuid]", Query.JCR_SQL2);
assertNotNull(q.execute());
}
use of javax.jcr.query.Query in project jackrabbit by apache.
the class QueryTest method testSQL2Limit.
/**
* https://issues.apache.org/jira/browse/JCR-2543
*/
public void testSQL2Limit() throws Exception {
Query q = qm.createQuery("SELECT * FROM [nt:unstructured]", Query.JCR_SQL2);
q.setLimit(1);
QueryResult r = q.execute();
NodeIterator it = r.getNodes();
assertTrue(it.hasNext());
it.next();
assertFalse(it.hasNext());
}
use of javax.jcr.query.Query in project jackrabbit-oak by apache.
the class OrderedIndexQueryBaseTest method runTest.
@Override
protected void runTest() throws Exception {
QueryManager qm = session.getWorkspace().getQueryManager();
Query q = qm.createQuery(getQuery(), Query.JCR_SQL2);
QueryResult r = q.execute();
NodeIterator nodes = r.getNodes();
int counter = 0;
while (nodes.hasNext() && counter++ < FETCH_NODES) {
nodes.next();
}
}
use of javax.jcr.query.Query in project jackrabbit-oak by apache.
the class FullTextSearchTest method runTest.
@SuppressWarnings("deprecation")
@Override
protected void runTest(TestContext ec) throws Exception {
QueryManager qm = ec.session.getWorkspace().getQueryManager();
// like > 20% of the perf lost in Collections.sort
for (String word : ec.words) {
Query q = qm.createQuery("//*[jcr:contains(@text, '" + word + "')] ", Query.XPATH);
QueryResult r = q.execute();
RowIterator it = r.getRows();
for (int rows = 0; it.hasNext() && rows < maxRowsToFetch; rows++) {
Node n = it.nextRow().getNode();
ec.hash += n.getProperty("text").getString().hashCode();
ec.hash += n.getProperty("title").getString().hashCode();
}
}
}
use of javax.jcr.query.Query in project jackrabbit-oak by apache.
the class LucenePropertyFullTextTest method performQuery.
private boolean performQuery(@Nonnull final TestContext ec) throws RepositoryException {
QueryManager qm = ec.session.getWorkspace().getQueryManager();
ValueFactory vf = ec.session.getValueFactory();
Query q = qm.createQuery("SELECT * FROM [nt:base] WHERE [title] = $title", Query.JCR_SQL2);
q.bindValue("title", vf.createValue(ec.title));
LOG.trace("statement: {} - title: {}", q.getStatement(), ec.title);
RowIterator rows = q.execute().getRows();
if (rows.hasNext()) {
rows.nextRow().getPath();
return true;
} else {
return false;
}
}
Aggregations