fabriziofortino commented on code in PR #679:
URL: https://github.com/apache/jackrabbit-oak/pull/679#discussion_r957114359


##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/ElasticRequestHandler.java:
##########
@@ -573,54 +575,53 @@ private List<Query> nonFullTextConstraints(IndexPlan 
plan, PlanResult planResult
 
         Filter filter = plan.getFilter();
         if (!filter.matchesAllTypes()) {
-            queries.add(nodeTypeConstraints(planResult.indexingRule, filter));
+            nodeTypeConstraints(planResult.indexingRule, 
filter).ifPresent(queries::add);
+            //queries.add(nodeTypeConstraints(planResult.indexingRule, 
filter));
         }
 
-        String path = FulltextIndex.getPathRestriction(plan);
-        switch (filter.getPathRestriction()) {
-        case ALL_CHILDREN:
-            if (!"/".equals(path)) {
-                queries.add(newAncestorQuery(path));
-            }
-            break;
-        case DIRECT_CHILDREN:
-            queries.add(Query.of(q -> q.bool(b -> 
b.must(newAncestorQuery(path)).must(newDepthQuery(path, planResult)))));
-            break;
-        case EXACT:
-            // For transformed paths, we can only add path restriction if 
absolute path to
-            // property can be
-            // deduced
-            if (planResult.isPathTransformed()) {
-                String parentPathSegment = planResult.getParentPathSegment();
-                if (!any.test(PathUtils.elements(parentPathSegment), "*")) {
-                    queries.add(newPathQuery(path + parentPathSegment));
-                }
-            } else {
-                queries.add(newPathQuery(path));
-            }
-            break;
-        case PARENT:
-            if (PathUtils.denotesRoot(path)) {
-                // there's no parent of the root node
-                // we add a path that can not possibly occur because there
-                // is no way to say "match no documents" in Lucene
-                queries.add(newPathQuery("///"));
-            } else {
-                // For transformed paths, we can only add path restriction if 
absolute path to
-                // property can be
-                // deduced
-                if (planResult.isPathTransformed()) {
-                    String parentPathSegment = 
planResult.getParentPathSegment();
-                    if (!any.test(PathUtils.elements(parentPathSegment), "*")) 
{
-                        queries.add(newPathQuery(PathUtils.getParentPath(path) 
+ parentPathSegment));
+        if (elasticIndexDefinition.evaluatePathRestrictions()) {

Review Comment:
   This is actually `false` by default.
   
   https://jackrabbit.apache.org/oak/docs/query/lucene.html#index-definition
   
   
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java#L428
   
   Do you see any problem with that?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to