You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by GitBox <gi...@apache.org> on 2021/09/29 21:26:15 UTC

[GitHub] [jackrabbit-oak] etugarev opened a new pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

etugarev opened a new pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378


   Jira: https://issues.apache.org/jira/browse/OAK-9587
   
   Changes:
   
   - Implemented a 'strict' mode for tag checking, was hesitating whether we boolean is enough and decided to leave more room if we need to add more statuses in the future
   - removed unused imports here and there (courtesy of intelliJ, not mine)
   - ensured adding 'tagsMatchingPolicy' does not cause reindex.
   


-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] averma21 commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
averma21 commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728906804



##########
File path: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
##########
@@ -624,6 +622,7 @@ private static Tree getOrCreateChild(Tree tree, String name){
                 IndexConstants.USE_IF_EXISTS,
                 IndexConstants.QUERY_PATHS,
                 IndexConstants.INDEX_TAGS,
+                IndexConstants.INDEX_SELECTION_POLICY,

Review comment:
       This class is deprecated. You probably need to change org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder
   That class is also extended by ElasticIndexDefinitionBuilder.




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] etugarev commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
etugarev commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728941025



##########
File path: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
##########
@@ -624,6 +622,7 @@ private static Tree getOrCreateChild(Tree tree, String name){
                 IndexConstants.USE_IF_EXISTS,
                 IndexConstants.QUERY_PATHS,
                 IndexConstants.INDEX_TAGS,
+                IndexConstants.INDEX_SELECTION_POLICY,

Review comment:
       @thomasmueller @averma21 I agree, there are things to improve, but this was not in scope of this PR. Currently both builders support it, so this change should be transparent.




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] etugarev commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
etugarev commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728923742



##########
File path: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
##########
@@ -624,6 +622,7 @@ private static Tree getOrCreateChild(Tree tree, String name){
                 IndexConstants.USE_IF_EXISTS,
                 IndexConstants.QUERY_PATHS,
                 IndexConstants.INDEX_TAGS,
+                IndexConstants.INDEX_SELECTION_POLICY,

Review comment:
       @averma21 this deprecated class is still used, so i changed it. I also changed `org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder` and added tests there.




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] etugarev commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
etugarev commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728923742



##########
File path: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
##########
@@ -624,6 +622,7 @@ private static Tree getOrCreateChild(Tree tree, String name){
                 IndexConstants.USE_IF_EXISTS,
                 IndexConstants.QUERY_PATHS,
                 IndexConstants.INDEX_TAGS,
+                IndexConstants.INDEX_SELECTION_POLICY,

Review comment:
       @averma21 this deprecated class is still used, so i changed it.




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] thomasmueller commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
thomasmueller commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728700610



##########
File path: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndex.java
##########
@@ -183,6 +184,10 @@ private static boolean wrongIndex(ChildNodeEntry entry, Filter filter, NodeState
             }
             // no tag matches
             return true;
+        } else if (tags != null && IndexSelectionPolicy.TAG.equals(

Review comment:
       I would say "tags != null && " is not needed here: let's assume someone doesn't set any tag in the index definition, but uses selectionPolicy="tag". I would expect that the index is never used in this case. But in your logic, it might be used. We would also need a test case for this.
   
   Moving String[] tags = getOptionalStrings(definition, IndexConstants.INDEX_TAGS); is then also not needed.

##########
File path: oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndexPlanner.java
##########
@@ -426,6 +427,9 @@ private boolean wrongIndex() {
             }
             // no tag matches
             return true;
+        } else if (tags != null && IndexSelectionPolicy.TAG.equals(definition.getIndexSelectionPolicy())) {

Review comment:
       Same as in the other case.




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] etugarev commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
etugarev commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728941025



##########
File path: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
##########
@@ -624,6 +622,7 @@ private static Tree getOrCreateChild(Tree tree, String name){
                 IndexConstants.USE_IF_EXISTS,
                 IndexConstants.QUERY_PATHS,
                 IndexConstants.INDEX_TAGS,
+                IndexConstants.INDEX_SELECTION_POLICY,

Review comment:
       @thomasmueller @averma21 I agree, there are things to improve (like code reorganisation), but this was not in scope of this PR. Currently both builders support it, so this change should be transparent. Also, switching the clients to a `org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder` would require some additional work.




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] thomasmueller commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
thomasmueller commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728925974



##########
File path: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
##########
@@ -624,6 +622,7 @@ private static Tree getOrCreateChild(Tree tree, String name){
                 IndexConstants.USE_IF_EXISTS,
                 IndexConstants.QUERY_PATHS,
                 IndexConstants.INDEX_TAGS,
+                IndexConstants.INDEX_SELECTION_POLICY,

Review comment:
       Hm, we need to move it to org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder... The Lucene class might still be there for compatibility, but we need to use the org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder. The clients that need selectionPolicy need to be migrated. We might want to deprecate the Lucene one.
   




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] thomasmueller commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
thomasmueller commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r729063075



##########
File path: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
##########
@@ -624,6 +622,7 @@ private static Tree getOrCreateChild(Tree tree, String name){
                 IndexConstants.USE_IF_EXISTS,
                 IndexConstants.QUERY_PATHS,
                 IndexConstants.INDEX_TAGS,
+                IndexConstants.INDEX_SELECTION_POLICY,

Review comment:
       what if we add the method to both classes? (the lucene one and the new one).




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] etugarev commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
etugarev commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728851513



##########
File path: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndex.java
##########
@@ -183,6 +184,10 @@ private static boolean wrongIndex(ChildNodeEntry entry, Filter filter, NodeState
             }
             // no tag matches
             return true;
+        } else if (tags != null && IndexSelectionPolicy.TAG.equals(

Review comment:
       done




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] etugarev commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
etugarev commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728851586



##########
File path: oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndexPlanner.java
##########
@@ -426,6 +427,9 @@ private boolean wrongIndex() {
             }
             // no tag matches
             return true;
+        } else if (tags != null && IndexSelectionPolicy.TAG.equals(definition.getIndexSelectionPolicy())) {

Review comment:
       done




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] etugarev commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
etugarev commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728941025



##########
File path: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
##########
@@ -624,6 +622,7 @@ private static Tree getOrCreateChild(Tree tree, String name){
                 IndexConstants.USE_IF_EXISTS,
                 IndexConstants.QUERY_PATHS,
                 IndexConstants.INDEX_TAGS,
+                IndexConstants.INDEX_SELECTION_POLICY,

Review comment:
       @thomasmueller @averma21 I agree, there are things to improve (like code reorganisation), but this was not in scope of this PR. Currently both builders support it, so this change should be transparent. Also, switching the clients to a `org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder` would require a public release.




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] tihom88 commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
tihom88 commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r719226723



##########
File path: oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java
##########
@@ -288,6 +288,8 @@
     @Nullable
     private final String[] indexTags;
 
+    private final String tagsMatchingPolicy;

Review comment:
       indexTagsMatchingPolicy

##########
File path: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexConstants.java
##########
@@ -114,6 +114,11 @@
      */
     String INDEX_TAGS = "tags";
 
+    /**
+     * The property to indicate tags matching policy. Currently, only 'TagsMatchingPolicy.STRICT' has effect
+     */
+    String TAGS_MATCHING_POLICY = "tagsMatchingPolicy";

Review comment:
       I think INDEX_TAGS_MATCHING_POLICY should be used.




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] etugarev commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
etugarev commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r719508230



##########
File path: oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/IndexDefinition.java
##########
@@ -288,6 +288,8 @@
     @Nullable
     private final String[] indexTags;
 
+    private final String tagsMatchingPolicy;

Review comment:
       fixed

##########
File path: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexConstants.java
##########
@@ -114,6 +114,11 @@
      */
     String INDEX_TAGS = "tags";
 
+    /**
+     * The property to indicate tags matching policy. Currently, only 'TagsMatchingPolicy.STRICT' has effect
+     */
+    String TAGS_MATCHING_POLICY = "tagsMatchingPolicy";

Review comment:
       fixed




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] averma21 commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
averma21 commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728907553



##########
File path: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
##########
@@ -624,6 +622,7 @@ private static Tree getOrCreateChild(Tree tree, String name){
                 IndexConstants.USE_IF_EXISTS,
                 IndexConstants.QUERY_PATHS,
                 IndexConstants.INDEX_TAGS,
+                IndexConstants.INDEX_SELECTION_POLICY,

Review comment:
       @tihom88 I think probably you did this refactoring. Any inputs?




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jackrabbit-oak] etugarev commented on a change in pull request #378: OAK-9587 - Add an attribute to enforce a strict index tag check

Posted by GitBox <gi...@apache.org>.
etugarev commented on a change in pull request #378:
URL: https://github.com/apache/jackrabbit-oak/pull/378#discussion_r728941025



##########
File path: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/util/IndexDefinitionBuilder.java
##########
@@ -624,6 +622,7 @@ private static Tree getOrCreateChild(Tree tree, String name){
                 IndexConstants.USE_IF_EXISTS,
                 IndexConstants.QUERY_PATHS,
                 IndexConstants.INDEX_TAGS,
+                IndexConstants.INDEX_SELECTION_POLICY,

Review comment:
       @thomasmueller @averma21 I agree, there are things to improve (like code reorganisation), but this was not in scope of this PR. Currently both builders support it, so this change should be transparent.




-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org