Search in sources :

Example 26 with ResultRow

use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.

the class FunctionIndexTest method explainXpath.

protected String explainXpath(String query) throws ParseException {
    String explain = "explain " + query;
    Result result = executeQuery(explain, "xpath", NO_BINDINGS);
    ResultRow row = Iterables.getOnlyElement(result.getRows());
    String plan = row.getValue("plan").getValue(Type.STRING);
    return plan;
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Result(org.apache.jackrabbit.oak.api.Result)

Example 27 with ResultRow

use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.

the class SuggestionIntervalTest method getSuggestions.

Set<String> getSuggestions(String nodeType, String suggestFor) throws Exception {
    Set<String> ret = Sets.newHashSet();
    String suggQuery = createSuggestQuery(nodeType, suggestFor);
    QueryEngine qe = root.getQueryEngine();
    Result result = qe.executeQuery(suggQuery, Query.JCR_SQL2, null, null);
    for (ResultRow row : result.getRows()) {
        ret.add(row.getValue("suggestion").toString());
    }
    return ret;
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) QueryEngine(org.apache.jackrabbit.oak.api.QueryEngine) Result(org.apache.jackrabbit.oak.api.Result)

Example 28 with ResultRow

use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.

the class LucenePropertyIndexTest method explainXpath.

private String explainXpath(String query) throws ParseException {
    String explain = "explain " + query;
    Result result = executeQuery(explain, "xpath", NO_BINDINGS);
    ResultRow row = Iterables.getOnlyElement(result.getRows());
    return row.getValue("plan").getValue(Type.STRING);
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ExtractionResult(org.apache.jackrabbit.oak.plugins.index.fulltext.ExtractedText.ExtractionResult) Result(org.apache.jackrabbit.oak.api.Result)

Example 29 with ResultRow

use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.

the class ContentRemoteResultTest method testWeakReferenceColumn.

@Test
public void testWeakReferenceColumn() {
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.WEAKREFERENCE).when(value).getType();
    doReturn("value").when(value).getValue(Type.WEAKREFERENCE);
    ResultRow row = mock(ResultRow.class);
    doReturn(value).when(row).getValue("column");
    ContentRemoteResult result = createResult(row);
    RemoteValue remoteValue = result.getColumnValue("column");
    assertEquals("value", remoteValue.asWeakReference());
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) PropertyValue(org.apache.jackrabbit.oak.api.PropertyValue) RemoteValue(org.apache.jackrabbit.oak.remote.RemoteValue) Test(org.junit.Test)

Example 30 with ResultRow

use of org.apache.jackrabbit.oak.api.ResultRow in project jackrabbit-oak by apache.

the class ContentRemoteResultTest method testMultiDateColumn.

@Test
public void testMultiDateColumn() {
    Date first = new Date(4);
    Date second = new Date(2);
    PropertyValue value = mock(PropertyValue.class);
    doReturn(Type.DATES).when(value).getType();
    doReturn(toFormattedDates(first, second)).when(value).getValue(Type.DATES);
    ResultRow row = mock(ResultRow.class);
    doReturn(value).when(row).getValue("column");
    ContentRemoteResult result = createResult(row);
    RemoteValue remoteValue = result.getColumnValue("column");
    assertEquals(asList(4L, 2L), remoteValue.asMultiDate());
}
Also used : ResultRow(org.apache.jackrabbit.oak.api.ResultRow) PropertyValue(org.apache.jackrabbit.oak.api.PropertyValue) RemoteValue(org.apache.jackrabbit.oak.remote.RemoteValue) Date(java.util.Date) Test(org.junit.Test)

Aggregations

ResultRow (org.apache.jackrabbit.oak.api.ResultRow)41 Test (org.junit.Test)29 PropertyValue (org.apache.jackrabbit.oak.api.PropertyValue)26 RemoteValue (org.apache.jackrabbit.oak.remote.RemoteValue)24 Result (org.apache.jackrabbit.oak.api.Result)12 Tree (org.apache.jackrabbit.oak.api.Tree)4 ParseException (java.text.ParseException)3 Root (org.apache.jackrabbit.oak.api.Root)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 Iterator (java.util.Iterator)2 NoSuchElementException (java.util.NoSuchElementException)2 Nonnull (javax.annotation.Nonnull)2 NodeIterator (javax.jcr.NodeIterator)2 RowIterator (javax.jcr.query.RowIterator)2 Blob (org.apache.jackrabbit.oak.api.Blob)2 PrefetchOptions (org.apache.jackrabbit.oak.jcr.query.PrefetchIterator.PrefetchOptions)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 BigDecimal (java.math.BigDecimal)1 HashSet (java.util.HashSet)1