Filter filter = plan.getFilter();
List<OrderEntry> sortOrder = plan.getSortOrder();
String pathPrefix = plan.getPathPrefix();
Iterable<String> paths = null;
OrderedContentMirrorStoreStrategy strategy
= OrderedPropertyIndexLookup.getStrategy(plan.getDefinition());
int depth = 1;
PropertyRestriction pr = plan.getPropertyRestriction();
if (pr != null) {
String propertyName = PathUtils.getName(pr.propertyName);
depth = PathUtils.getDepth(pr.propertyName);
paths = strategy.query(plan.getFilter(), propertyName,
plan.getDefinition(), pr, pathPrefix);
}
if (paths == null && sortOrder != null && !sortOrder.isEmpty()) {
// we could be here if we have a query where the ORDER BY makes us play it.
for (OrderEntry oe : sortOrder) {
String propertyName = PathUtils.getName(oe.getPropertyName());
depth = PathUtils.getDepth(oe.getPropertyName());
paths = strategy.query(plan.getFilter(), propertyName,
plan.getDefinition(), new PropertyRestriction(), pathPrefix);
}
}
if (paths == null) {