[jira] [Commented] (OAK-7410) Define SPIs for Oak Search module

2018-06-22 Thread Tommaso Teofili (JIRA)


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

Tommaso Teofili commented on OAK-7410:
--

I agree with your proposal Thomas.

The differences between oak-search and oak-lucene versions of 
IndexDefinitionBuilder were intentional because not everything in Lucene makes 
sense in an "abstract" definition.

So I'd be + 1 for encapsulating IDB within a LuceneIDB.

> 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.9.3
>
> 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)


[jira] [Commented] (OAK-7410) Define SPIs for Oak Search module

2018-06-21 Thread Thomas Mueller (JIRA)


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

Thomas Mueller commented on OAK-7410:
-

I wanted to remove the oak-lucene IndexDefinitionBuilder, as that exists in 
oak-search. But there are two differences:

* the oak-lucene impl sets "compatVersion" = 2, while the oak-search one doesn't
* the oak-lucene impl sets "type" = "lucene", while the oak-search one sets 
"type" = "fulltext"

The compatVersion, I think we should set it to 2.

The type, I'm not sure. The class is final, so how to use a different type? 
* Remove "final" and allow to extend the class, eg. in lucene - I don't prefer 
that - I would rather use encapsulation than extension.
* Maybe the type could be set to the right impl ("lucene", "solr") AFTER the 
config is done.

> 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.9.3
>
> 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)


[jira] [Commented] (OAK-7410) Define SPIs for Oak Search module

2018-06-21 Thread Thomas Mueller (JIRA)


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

Thomas Mueller commented on OAK-7410:
-

[~teofili] I have a question. I would like to like to get rid of the oak-lucene 
ConfigUtil as that's in oak-search. But the one in oak-search has a difference 
(in the last method) I don't understand, and I couldn't find out why it's 
different. According to svn / git blame, the change was introduced when you 
originally created the oak-search version of it... so, do you remember why you 
changed it? oak-search version:

{noformat}
@CheckForNull
public static Blob getBlob(NodeState state, String resourceName){
NodeState contentNode = state.getChildNode(JcrConstants.JCR_CONTENT);
checkArgument(contentNode.exists(), "Was expecting to find jcr:content 
node to read resource %s", resourceName);
PropertyState property = contentNode.getProperty(JcrConstants.JCR_DATA);
return property != null ? property.getValue(Type.BINARY) : null;
}
{noformat}

It is used in IndexDefinition, where interestingly there is no check for null:

{noformat}
 public InputStream getTikaConfig(){
return ConfigUtil.getBlob(getTikaConfigNode(), 
TIKA_CONFIG).getNewStream();
}

private NodeState getTikaConfigNode() {
return definition.getChildNode(TIKA).getChildNode(TIKA_CONFIG);
}
{noformat}

oak-lucene version:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/ConfigUtil.java?annotate=1714238
{noformat}
public static Blob getBlob(NodeState state, String resourceName){
NodeState contentNode = state.getChildNode(JcrConstants.JCR_CONTENT);
checkArgument(contentNode.exists(), "Was expecting to find jcr:content 
node to read resource %s", resourceName);
return 
contentNode.getProperty(JcrConstants.JCR_DATA).getValue(Type.BINARY);
}
{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.9.3
>
> 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)


[jira] [Commented] (OAK-7410) Define SPIs for Oak Search module

2018-06-07 Thread Chetan Mehrotra (JIRA)


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

Chetan Mehrotra commented on OAK-7410:
--

[~tmueller] +1 for the changes.

> 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.9.3
>
> 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)


[jira] [Commented] (OAK-7410) Define SPIs for Oak Search module

2018-06-06 Thread Thomas Mueller (JIRA)


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

Thomas Mueller commented on OAK-7410:
-

[~chetanm], as you wrote this part originally, what do you think about the 
patch in the last comment (remove generic type from Include)? I will only do 
that in oak-search first.

> 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.9.3
>
> 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)


[jira] [Commented] (OAK-7410) Define SPIs for Oak Search module

2018-06-01 Thread Thomas Mueller (JIRA)


[ 
https://issues.apache.org/jira/browse/OAK-7410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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 {
+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 {
+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 {
+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)


[jira] [Commented] (OAK-7410) Define SPIs for Oak Search module

2018-06-01 Thread Thomas Mueller (JIRA)


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

Thomas Mueller commented on OAK-7410:
-

The Aggregate class uses raw types. I tried to fix that, but I still don't 
understand the logic used there (abstract class Include, and NodeInclude 
extends Include). So it's quite a mess. My work-in-progress is 
[attached|https://issues.apache.org/jira/secure/attachment/12926083/AggregateGenerics.patch].

> 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)


[jira] [Commented] (OAK-7410) Define SPIs for Oak Search module

2018-05-28 Thread Vikas Saurabh (JIRA)

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

Vikas Saurabh commented on OAK-7410:


Added {{ExtractedTextCacheTest}} in oak-search module at 
[r1832378|https://svn.apache.org/r1832378].

> 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
>
>
> 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)


[jira] [Commented] (OAK-7410) Define SPIs for Oak Search module

2018-05-21 Thread Tommaso Teofili (JIRA)

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

Tommaso Teofili commented on OAK-7410:
--

committer first editor draft in r1831979.

> 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
>
>
> 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)


[jira] [Commented] (OAK-7410) Define SPIs for Oak Search module

2018-05-21 Thread Tommaso Teofili (JIRA)

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

Tommaso Teofili commented on OAK-7410:
--

this task can be split in more sub tasks:
 # create abstract index editor implementation
 # create abstract query index implementation
 # (optional) create test index implementation extending both editor and query 
index to make verify SPIs satisfy all requirements and constraints

 

> 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
>
>
> 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)