protected List<T> readResult(RowIterator rowIterator, NodeFilter filter) throws RepositoryException { List<T> list = new ArrayList<>(); while (rowIterator.hasNext()) { Row row = rowIterator.nextRow(); String path = row.getValue("jcr:path").getString(); T newInstance = getEntity(path, filter); list.add(newInstance); } return list; }
public Object call(Query query) throws RepositoryException { RowIterator rows = query.execute().getRows(); assertTrue("empty result", rows.hasNext()); Row r = rows.nextRow(); assertEquals("unexpected value", TEST_VALUE, r.getValue(columnName1).getString()); assertEquals("unexpected value", TEST_VALUE, r.getValue(columnName2).getString()); return null; } });
private Node iterate(Query query) throws RepositoryException { QueryResult r = query.execute(); RowIterator it = r.getRows(); Node last = null; while (it.hasNext()) { last = it.nextRow().getNode(); LOG.debug(last.getPath()); } return last; }
public Object call(Query query) throws RepositoryException { RowIterator rows = query.execute().getRows(); while (rows.hasNext()) { double score = rows.nextRow().getScore("s"); if (!Double.isNaN(score)) { assertTrue("wrong full text search score", Double.MIN_VALUE < score); } } return null; } });
protected void search(QueryManager qm, ExecutionContext context) throws RepositoryException { Query q = getQuery(qm, context); QueryResult r = q.execute(); RowIterator it = r.getRows(); for (int rows = 0; it.hasNext() && rows < MAX_RESULTS; rows++) { Node node = it.nextRow().getNode(); LOG.debug(node.getPath()); } }
@Override public boolean isAfterLast() throws SQLException { this.notClosed(); if (this.row == null && !this.rowIter.hasNext() && this.rowIter.getPosition() == this.rowIter.getSize()) { return true; } return false; }
protected void printRows() throws RepositoryException { while (iter.hasNext()) { printRow(); } }
@Override public boolean isLast() throws SQLException { this.notClosed(); if (this.row != null && !this.rowIter.hasNext() && this.rowIter.getPosition() == this.rowIter.getSize()) { return true; } return false; }
@Override protected void search(QueryManager qm, ExecutionContext context) throws RepositoryException { searchCommon(qm, context); Query q = getQuery(qm, context); QueryResult r = q.execute(); RowIterator it = r.getRows(); for (int rows = 0; it.hasNext() && rows < LIMIT; rows++) { Node node = it.nextRow().getNode(); LOG.debug(node.getPath()); } }
@Override protected void search(QueryManager qm, ExecutionContext context) throws RepositoryException { searchCommon(qm, context); Query q = getQuery(qm, context); QueryResult r = q.execute(); RowIterator it = r.getRows(); for (int rows = 0; it.hasNext() && rows < LIMIT; rows++) { Node node = it.nextRow().getNode(); LOG.debug(node.getPath()); } }
static String getResult(QueryResult result, String propertyName) throws RepositoryException { StringBuilder buff = new StringBuilder(); RowIterator it = result.getRows(); while (it.hasNext()) { if (buff.length() > 0) { buff.append(", "); } buff.append(it.nextRow().getValue(propertyName).getString()); } return buff.toString(); }
static String getResult(QueryResult result, String propertyName) throws RepositoryException { StringBuilder buff = new StringBuilder(); RowIterator it = result.getRows(); while (it.hasNext()) { if (buff.length() > 0) { buff.append(", "); } buff.append(it.nextRow().getValue(propertyName).getString()); } return buff.toString(); }
static List<String> getResult(QueryResult result, String propertyName) throws RepositoryException { List<String> results = Lists.newArrayList(); RowIterator it = result.getRows(); while (it.hasNext()) { Row row = it.nextRow(); results.add(row.getValue(propertyName).getString()); } return results; }
static List<String> getResult(QueryResult result, String propertyName) throws RepositoryException { List<String> results = Lists.newArrayList(); RowIterator it = result.getRows(); while (it.hasNext()) { Row row = it.nextRow(); results.add(row.getValue(propertyName).getString()); } return results; }
static List<String> getResult(QueryResult result, String propertyName) throws RepositoryException { List<String> results = Lists.newArrayList(); RowIterator it = result.getRows(); while (it.hasNext()) { Row row = it.nextRow(); results.add(row.getValue(propertyName).getString()); } return results; }
public void testScoreWithoutFulltext() throws Exception { System.out.println(Query.JCR_SQL2); QueryResult r = executeSQL2Query("select [jcr:path] from [nt:base] order by [jcr:score]"); RowIterator it = r.getRows(); while (it.hasNext()) { it.nextRow(); } }
protected void assertResultsHaveRows( QueryResult result, String columnName, String... rowValuesAsStrings ) throws RepositoryException { RowIterator iter = result.getRows(); int i = 0; while (iter.hasNext()) { Row row = iter.nextRow(); assertThat(row.getValue(columnName).getString(), is(rowValuesAsStrings[i++])); } }
private void readResult(QueryResult result, int count) throws RepositoryException { for (RowIterator rows = result.getRows(); rows.hasNext();) { rows.nextRow(); count--; } assertEquals(0, count); }
private Set<String> getSuggestions(String query) throws Exception { QueryManager queryManager = session.getWorkspace().getQueryManager(); QueryResult result = queryManager.createQuery(query, Query.JCR_SQL2).execute(); RowIterator rows = result.getRows(); Set<String> suggestions = newHashSet(); while (rows.hasNext()) { suggestions.add(rows.nextRow().getValue("suggestion").getString()); } return suggestions; }
@SuppressWarnings( "deprecation" ) @Test public void shouldBeAbleToExecuteXPathQueryWithComplexContainsCriteriaWithNoHyphenAndNoWildcard() throws RepositoryException { String xpath = "/jcr:root//*[jcr:contains(., '\"heavy duty\"')]"; Query query = session.getWorkspace().getQueryManager().createQuery(xpath, Query.XPATH); QueryResult result = query.execute(); // by default there is no stemming or punctuation replacement assertFalse(result.getRows().hasNext()); }