@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()); }
@Override public List<IndexPlan> getPlans(Filter filter, List<OrderEntry> sortOrder, NodeState rootState) { Collection<String> indexPaths = new SolrIndexLookup(rootState).collectIndexNodePaths(filter); List<IndexPlan> plans = Lists.newArrayListWithCapacity(indexPaths.size()); log.debug("looking for plans for paths : {}", indexPaths); for (String path : indexPaths) { OakSolrConfiguration configuration = getConfiguration(path, rootState); SolrClient solrServer = getServer(path, rootState); log.debug("building plan for server {} and configuration {}", solrServer, configuration); if (configuration != null && solrServer != null) { LMSEstimator estimator = getEstimator(path); IndexPlan plan = getIndexPlan(filter, configuration, estimator, sortOrder, path); if (plan != null) { plans.add(plan); } } } return plans; }
SolrQueryIndex implements FulltextQueryIndex, QueryIndex.AdvanceFulltextQueryIndex { @Override public List<IndexPlan> getPlans(Filter filter, List<OrderEntry> sortOrder, NodeState rootState) { Collection<String> indexPaths = new SolrIndexLookup(rootState).collectIndexNodePaths(filter); List<IndexPlan> plans = Lists.newArrayListWithCapacity(indexPaths.size()); log.debug("looking for plans for paths : {}", indexPaths); for (String path : indexPaths) { OakSolrConfiguration configuration = getConfiguration(path, rootState); SolrClient solrServer = getServer(path, rootState); log.debug("building plan for server {} and configuration {}", solrServer, configuration); if (configuration != null && solrServer != null) { LMSEstimator estimator = getEstimator(path); IndexPlan plan = getIndexPlan(filter, configuration, estimator, sortOrder, path); if (plan != null) { plans.add(plan); } } } return plans; } }
SolrQueryIndex implements FulltextQueryIndex, QueryIndex.AdvanceFulltextQueryIndex { @Override public List<IndexPlan> getPlans(Filter filter, List<OrderEntry> sortOrder, NodeState rootState) { Collection<String> indexPaths = new SolrIndexLookup(rootState).collectIndexNodePaths(filter); List<IndexPlan> plans = Lists.newArrayListWithCapacity(indexPaths.size()); log.debug("looking for plans for paths : {}", indexPaths); for (String path : indexPaths) { OakSolrConfiguration configuration = getConfiguration(path, rootState); SolrClient solrServer = getServer(path, rootState); log.debug("building plan for server {} and configuration {}", solrServer, configuration); if (configuration != null && solrServer != null) { LMSEstimator estimator = getEstimator(path); IndexPlan plan = getIndexPlan(filter, configuration, estimator, sortOrder, path); if (plan != null) { plans.add(plan); } } } return plans; } SolrQueryIndex(NodeAggregator aggregator, OakSolrConfigurationProvider oakSolrConfigurationProvider, SolrServerProvider solrServerProvider); }
SolrQueryIndex implements FulltextQueryIndex, QueryIndex.AdvanceFulltextQueryIndex { @Override public List<IndexPlan> getPlans(Filter filter, List<OrderEntry> sortOrder, NodeState rootState) { Collection<String> indexPaths = new SolrIndexLookup(rootState).collectIndexNodePaths(filter); List<IndexPlan> plans = Lists.newArrayListWithCapacity(indexPaths.size()); log.debug("looking for plans for paths : {}", indexPaths); for (String path : indexPaths) { OakSolrConfiguration configuration = getConfiguration(path, rootState); SolrClient solrServer = getServer(path, rootState); log.debug("building plan for server {} and configuration {}", solrServer, configuration); if (configuration != null && solrServer != null) { LMSEstimator estimator = getEstimator(path); IndexPlan plan = getIndexPlan(filter, configuration, estimator, sortOrder, path); if (plan != null) { plans.add(plan); } } } return plans; } SolrQueryIndex(NodeAggregator aggregator, OakSolrConfigurationProvider oakSolrConfigurationProvider, SolrServerProvider solrServerProvider); @Override double getMinimumCost(); @Override String getIndexName(); @Override double getCost(Filter filter, NodeState root); @Override String getPlan(Filter filter, NodeState nodeState); @Override Cursor query(final IndexPlan plan, final NodeState root); @Override List<IndexPlan> getPlans(Filter filter, List<OrderEntry> sortOrder, NodeState rootState); @Override String getPlanDescription(IndexPlan plan, NodeState root); @Override Cursor query(Filter filter, NodeState rootState); @Override @Nullable NodeAggregator getNodeAggregator(); }
SolrQueryIndex implements FulltextQueryIndex, QueryIndex.AdvanceFulltextQueryIndex { @Override public List<IndexPlan> getPlans(Filter filter, List<OrderEntry> sortOrder, NodeState rootState) { Collection<String> indexPaths = new SolrIndexLookup(rootState).collectIndexNodePaths(filter); List<IndexPlan> plans = Lists.newArrayListWithCapacity(indexPaths.size()); log.debug("looking for plans for paths : {}", indexPaths); for (String path : indexPaths) { OakSolrConfiguration configuration = getConfiguration(path, rootState); SolrClient solrServer = getServer(path, rootState); log.debug("building plan for server {} and configuration {}", solrServer, configuration); if (configuration != null && solrServer != null) { LMSEstimator estimator = getEstimator(path); IndexPlan plan = getIndexPlan(filter, configuration, estimator, sortOrder, path); if (plan != null) { plans.add(plan); } } } return plans; } SolrQueryIndex(NodeAggregator aggregator, OakSolrConfigurationProvider oakSolrConfigurationProvider, SolrServerProvider solrServerProvider); @Override double getMinimumCost(); @Override String getIndexName(); @Override double getCost(Filter filter, NodeState root); @Override String getPlan(Filter filter, NodeState nodeState); @Override Cursor query(final IndexPlan plan, final NodeState root); @Override List<IndexPlan> getPlans(Filter filter, List<OrderEntry> sortOrder, NodeState rootState); @Override String getPlanDescription(IndexPlan plan, NodeState root); @Override Cursor query(Filter filter, NodeState rootState); @Override @Nullable NodeAggregator getNodeAggregator(); static final String TYPE; }