private GroupPrincipalIterator(@Nullable String queryString, @NotNull Result queryResult) { this.queryString = queryString; rows = queryResult.getRows().iterator(); }
@Override public long getTotal() { return results.getSize(); }
@Override public String[] getColumnNames() throws RepositoryException { return result.getColumnNames(); }
Iterator<RowImpl> rowIterator = new Iterator<RowImpl>() { private final Iterator<? extends ResultRow> it = result.getRows().iterator(); private final String pathSelector; private RowImpl current; String[] columnSelectorNames = result.getColumnSelectorNames(); if (columnSelectorNames.length == 1) { pathSelector = columnSelectorNames[0]; sessionDelegate.sync(rowIterator), new PrefetchOptions() { { size = result.getSize(); fastSize = sessionContext.getFastQueryResultSize(); fastSizeCallback = result;
protected void assertResultSize(String query, String language, long expected) { long time = System.currentTimeMillis(); try { Result result = executeQuery(query, language, NO_BINDINGS); // currently needed to iterate to really execute the query result.getRows().iterator().hasNext(); long got = result.getSize(SizePrecision.APPROXIMATION, 0); assertEquals(expected, got); } catch (ParseException e) { throw new RuntimeException(e); } time = System.currentTimeMillis() - time; if (time > 10000 && !isDebugModeEnabled()) { fail("Query took too long: " + query + " took " + time + " ms"); } }
@Override public String[] getSelectorNames() { return result.getSelectorNames(); }
Iterator<RowImpl> rowIterator = new Iterator<RowImpl>() { private final Iterator<? extends ResultRow> it = result.getRows().iterator(); private final String pathSelector; private RowImpl current; String[] columnSelectorNames = result.getColumnSelectorNames(); if (columnSelectorNames.length == 1) { pathSelector = columnSelectorNames[0]; sessionDelegate.sync(rowIterator), new PrefetchOptions() { { size = result.getSize(); fastSize = sessionContext.getFastQueryResultSize(); fastSizeCallback = result;
@Test public void propertyIndex() throws Exception{ String idxName = "multitest"; createIndex(root.getTree("/"), idxName, Collections.singleton("foo")); root.commit(); createPath("/libs/a").setProperty("foo", "bar"); createPath("/libs/b").setProperty("foo", "bar2"); createPath("/content/a").setProperty("foo", "bar"); root.commit(); //There should be 2 index dir due to mount assertEquals(2, getIndexDirNames(idxName).size()); String barQuery = "select [jcr:path] from [nt:base] where [foo] = 'bar'"; assertQuery(barQuery, of("/libs/a", "/content/a")); Result result = executeQuery(barQuery, SQL2, NO_BINDINGS); assertTrue(result.getRows().iterator().hasNext()); assertEquals(2, result.getSize(Result.SizePrecision.FAST_APPROXIMATION, 100)); assertQuery("select [jcr:path] from [nt:base] where [foo] = 'bar2'", of("/libs/b")); }
@Override public String[] getSelectorNames() { return result.getSelectorNames(); }
private MemberIterator(@NotNull Result queryResult) { rows = queryResult.getRows().iterator(); }
Iterator<RowImpl> rowIterator = new Iterator<RowImpl>() { private final Iterator<? extends ResultRow> it = result.getRows().iterator(); private final String pathSelector; private RowImpl current; String[] columnSelectorNames = result.getColumnSelectorNames(); if (columnSelectorNames.length == 1) { pathSelector = columnSelectorNames[0]; sessionDelegate.sync(rowIterator), new PrefetchOptions() { { size = result.getSize(); fastSize = sessionContext.getFastQueryResultSize(); fastSizeCallback = result;
size = fastSizeCallback.getSize(SizePrecision.EXACT, Long.MAX_VALUE);
@Override public String[] getSelectorNames() { return result.getSelectorNames(); }
@Override public String[] getColumnNames() throws RepositoryException { return result.getColumnNames(); }
private Iterable<RemoteResult> getResults() { List<RemoteResult> results = newArrayList(); for (ResultRow row : this.results.getRows()) { results.add(new ContentRemoteResult(binaries, row)); } return results; }
@Override public NodeIterator getNodes() throws RepositoryException { String[] columnSelectorNames = result.getColumnSelectorNames(); if (columnSelectorNames.length != 1) { throw new RepositoryException("Query contains more than one selector: " + new Iterator<NodeImpl<? extends NodeDelegate>>() { private final Iterator<? extends ResultRow> it = result.getRows().iterator(); private NodeImpl<? extends NodeDelegate> current; sessionDelegate.sync(nodeIterator), new PrefetchOptions() { { size = result.getSize(); fastSize = sessionContext.getFastQueryResultSize(); fastSizeCallback = result;
size = fastSizeCallback.getSize(SizePrecision.EXACT, Long.MAX_VALUE);
@Override public Iterable<String> getSelectors() { return Arrays.asList(results.getSelectorNames()); }
@Override public String[] getColumnNames() throws RepositoryException { return result.getColumnNames(); }
@Override public Iterator<String> iterator() { return Iterators.concat(transform(result.getRows().iterator(), new RowToPaths())); }