use of org.apache.jackrabbit.oak.query.ast.SelectorImpl in project jackrabbit-oak by apache.
the class QueryImpl method currentRow.
ResultRowImpl currentRow() {
int selectorCount = selectors.size();
Tree[] trees = new Tree[selectorCount];
for (int i = 0; i < selectorCount; i++) {
SelectorImpl s = selectors.get(i);
trees[i] = s.currentTree();
}
int columnCount = columns.length;
PropertyValue[] values = new PropertyValue[columnCount];
for (int i = 0; i < columnCount; i++) {
ColumnImpl c = columns[i];
values[i] = c.currentProperty();
}
PropertyValue[] orderValues;
if (orderings == null) {
orderValues = null;
} else {
int size = orderings.length;
orderValues = new PropertyValue[size];
for (int i = 0; i < size; i++) {
orderValues[i] = orderings[i].getOperand().currentProperty();
}
}
return new ResultRowImpl(this, trees, values, distinctColumns, orderValues);
}
use of org.apache.jackrabbit.oak.query.ast.SelectorImpl in project jackrabbit-oak by apache.
the class ReferenceIndexTest method createFilter.
@SuppressWarnings("Duplicates")
private static FilterImpl createFilter(NodeState root, String nodeTypeName) {
NodeTypeInfoProvider nodeTypes = new NodeStateNodeTypeInfoProvider(root);
NodeTypeInfo type = nodeTypes.getNodeTypeInfo(nodeTypeName);
SelectorImpl selector = new SelectorImpl(type, nodeTypeName);
return new FilterImpl(selector, "SELECT * FROM [" + nodeTypeName + "]", new QueryEngineSettings());
}
use of org.apache.jackrabbit.oak.query.ast.SelectorImpl in project jackrabbit-oak by apache.
the class SolrQueryIndexTest method testNoPlanWithOnlyPrimaryTypeRestrictionsEnabled.
@Test
public void testNoPlanWithOnlyPrimaryTypeRestrictionsEnabled() throws Exception {
NodeBuilder builder = nodeState.builder();
builder.child("oak:index").child("solr").setProperty("primaryTypes", true);
nodeState = builder.getNodeState();
SelectorImpl selector = newSelector(nodeState, "a");
SolrQueryIndex solrQueryIndex = new SolrQueryIndex(null, null, null);
FilterImpl filter = new FilterImpl(selector, "select * from [nt:base] as a where jcr:primaryType = 'nt:unstructured')", new QueryEngineSettings());
filter.restrictProperty("jcr:primaryType", Operator.EQUAL, PropertyValues.newString("nt:unstructured"));
List<QueryIndex.OrderEntry> sortOrder = new LinkedList<QueryIndex.OrderEntry>();
List<QueryIndex.IndexPlan> plans = solrQueryIndex.getPlans(filter, sortOrder, nodeState);
assertEquals(0, plans.size());
}
use of org.apache.jackrabbit.oak.query.ast.SelectorImpl in project jackrabbit-oak by apache.
the class SolrQueryIndexTest method testNoPlanWithPropertyNotListedInUsedProperties.
@Test
public void testNoPlanWithPropertyNotListedInUsedProperties() throws Exception {
NodeBuilder builder = nodeState.builder();
builder.child("oak:index").child("solr").setProperty("usedProperties", Collections.singleton("name"), Type.STRINGS).setProperty("propertyRestrictions", true);
nodeState = builder.getNodeState();
SelectorImpl selector = newSelector(nodeState, "a");
SolrQueryIndex solrQueryIndex = new SolrQueryIndex(null, null, null);
FilterImpl filter = new FilterImpl(selector, "select * from [nt:base] as a where foo = 'bar')", new QueryEngineSettings());
filter.restrictProperty("foo", Operator.EQUAL, PropertyValues.newString("bar"));
List<QueryIndex.OrderEntry> sortOrder = new LinkedList<QueryIndex.OrderEntry>();
List<QueryIndex.IndexPlan> plans = solrQueryIndex.getPlans(filter, sortOrder, nodeState);
assertEquals(0, plans.size());
}
use of org.apache.jackrabbit.oak.query.ast.SelectorImpl in project jackrabbit-oak by apache.
the class SolrQueryIndexTest method testNoPlanWithPrimaryTypeRestrictions.
@Test
public void testNoPlanWithPrimaryTypeRestrictions() throws Exception {
SelectorImpl selector = newSelector(nodeState, "a");
SolrQueryIndex solrQueryIndex = new SolrQueryIndex(null, null, null);
FilterImpl filter = new FilterImpl(selector, "select * from [nt:base] as a where jcr:primaryType = 'nt:unstructured')", new QueryEngineSettings());
filter.restrictProperty("jcr:primaryType", Operator.EQUAL, PropertyValues.newString("nt:unstructured"));
List<QueryIndex.OrderEntry> sortOrder = new LinkedList<QueryIndex.OrderEntry>();
List<QueryIndex.IndexPlan> plans = solrQueryIndex.getPlans(filter, sortOrder, nodeState);
assertEquals(0, plans.size());
}
Aggregations