jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mueller (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OAK-7410) Define SPIs for Oak Search module
Date Fri, 01 Jun 2018 12:33:00 GMT

    [ https://issues.apache.org/jira/browse/OAK-7410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16497929#comment-16497929
] 

Thomas Mueller commented on OAK-7410:
-------------------------------------

The Aggregate class: here is a second attempt. Instead of using generics partially, it doesn't
use them, but checks the class explicitly. The advantage is simpler code, and I don't think
the old code would have prevented errors anyway.

{noformat}
Index: src/main/java/org/apache/jackrabbit/oak/plugins/index/search/Aggregate.java
===================================================================
--- src/main/java/org/apache/jackrabbit/oak/plugins/index/search/Aggregate.java	(revision
1832658)
+++ src/main/java/org/apache/jackrabbit/oak/plugins/index/search/Aggregate.java	(working copy)
@@ -222,7 +222,7 @@
 
     //~-----------------------------------------------------< Includes >
 
-    public static abstract class Include<T> {
+    public static abstract class Include {
         protected final String[] elements;
 
         public Include(String pattern) {
@@ -243,7 +243,7 @@
             return elements.length;
         }
 
-        public void collectResults(T rootInclude, String rootIncludePath,
+        public void collectResults(Include rootInclude, String rootIncludePath,
                                    String nodePath, NodeState nodeState,  ResultCollector
results) {
             collectResults(nodePath, nodeState, results);
         }
@@ -272,7 +272,7 @@
         }
     }
 
-    public static class NodeInclude extends Include<NodeInclude> {
+    public static class NodeInclude extends Include {
         final String primaryType;
         final boolean relativeNode;
         private final String pattern;
@@ -303,9 +303,13 @@
         }
 
         @Override
-        public void collectResults(NodeInclude rootInclude, String rootIncludePath, String
nodePath,
+        public void collectResults(Include include, String rootIncludePath, String nodePath,
                                    NodeState nodeState, ResultCollector results) {
             //For supporting jcr:contains(jcr:content, 'foo')
+            if (!(include instanceof NodeInclude)) {
+                throw new IllegalArgumentException("" + include);
+            }
+            NodeInclude rootInclude = (NodeInclude) include;
             if (rootInclude.relativeNode){
                 results.onResult(new NodeIncludeResult(nodePath, rootIncludePath, nodeState));
             }
@@ -365,7 +369,7 @@
         }
     }
 
-    public static class PropertyInclude extends Include<PropertyInclude> {
+    public static class PropertyInclude extends Include {
         private final PropertyDefinition propertyDefinition;
         private final String propertyName;
         private final Pattern pattern;
{noformat}

> Define SPIs for Oak Search module
> ---------------------------------
>
>                 Key: OAK-7410
>                 URL: https://issues.apache.org/jira/browse/OAK-7410
>             Project: Jackrabbit Oak
>          Issue Type: Technical task
>            Reporter: Tommaso Teofili
>            Assignee: Tommaso Teofili
>            Priority: Major
>             Fix For: 1.10
>
>         Attachments: AggregateGenerics.patch
>
>
> Abstract IndexEditor and QueryIndex implementations and SPIs should be created for Oak
Search module.
> Those classes should be then reused / extended by implementors in and outside Oak .



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message