use of org.apache.jackrabbit.oak.query.QueryEngineSettings in project jackrabbit-oak by apache.
the class SolrQueryIndexTest method testPlanWithPropertyRestrictionsEnabled.
@Test
public void testPlanWithPropertyRestrictionsEnabled() throws Exception {
NodeBuilder builder = nodeState.builder();
builder.child("oak:index").child("solr").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 name = 'hello')", new QueryEngineSettings());
filter.restrictProperty("name", Operator.EQUAL, PropertyValues.newString("hello"));
List<QueryIndex.OrderEntry> sortOrder = new LinkedList<QueryIndex.OrderEntry>();
List<QueryIndex.IndexPlan> plans = solrQueryIndex.getPlans(filter, sortOrder, nodeState);
assertEquals(1, plans.size());
}
use of org.apache.jackrabbit.oak.query.QueryEngineSettings in project jackrabbit-oak by apache.
the class SolrQueryIndexTest method testUnion.
@Test
public void testUnion() throws Exception {
SelectorImpl selector = mock(SelectorImpl.class);
SolrQueryIndex solrQueryIndex = new SolrQueryIndex(null, null, null);
String sqlQuery = "select [jcr:path], [jcr:score], [rep:excerpt] from [nt:hierarchyNode] as a where" + " isdescendantnode(a, '/content') and contains([jcr:content/*], 'founded') union select [jcr:path]," + " [jcr:score], [rep:excerpt] from [nt:hierarchyNode] as a where isdescendantnode(a, '/content') and " + "contains([jcr:content/jcr:title], 'founded') union select [jcr:path], [jcr:score], [rep:excerpt]" + " from [nt:hierarchyNode] as a where isdescendantnode(a, '/content') and " + "contains([jcr:content/jcr:description], 'founded') order by [jcr:score] desc";
FilterImpl filter = new FilterImpl(selector, sqlQuery, new QueryEngineSettings());
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.QueryEngineSettings in project jackrabbit-oak by apache.
the class ExternalIdentityImporterTest method before.
@Before
public void before() throws Exception {
securityProvider = new TestSecurityProvider(getConfigurationParameters(), new ExternalPrincipalConfiguration());
QueryEngineSettings queryEngineSettings = new QueryEngineSettings();
queryEngineSettings.setFailTraversal(true);
Jcr jcr = new Jcr();
jcr.with(securityProvider);
jcr.with(queryEngineSettings);
repo = jcr.createRepository();
}
use of org.apache.jackrabbit.oak.query.QueryEngineSettings in project jackrabbit-oak by apache.
the class AbstractSecurityTest method getQueryEngineSettings.
protected QueryEngineSettings getQueryEngineSettings() {
if (querySettings == null) {
querySettings = new QueryEngineSettings();
querySettings.setFailTraversal(true);
}
return querySettings;
}
use of org.apache.jackrabbit.oak.query.QueryEngineSettings in project jackrabbit-oak by apache.
the class AsyncPropertyIndexTest method createFilter.
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());
}
Aggregations