You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "fabriziofortino (via GitHub)" <gi...@apache.org> on 2023/07/21 13:08:36 UTC
[GitHub] [jackrabbit-oak] fabriziofortino opened a new pull request, #1035: OAK-10365: introduce mapping version in elastic index definition
fabriziofortino opened a new pull request, #1035:
URL: https://github.com/apache/jackrabbit-oak/pull/1035
(no comment)
--
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] nfsantos commented on a diff in pull request #1035: OAK-10365: introduce mapping version in elastic index definition
Posted by "nfsantos (via GitHub)" <gi...@apache.org>.
nfsantos commented on code in PR #1035:
URL: https://github.com/apache/jackrabbit-oak/pull/1035#discussion_r1273270397
##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticIndexDefinition.java:
##########
@@ -269,6 +274,14 @@ public boolean analyzerConfigSplitOnNumerics() {
return getOptionalValue(analyzersTree, SPLIT_ON_NUMERICS, false);
}
+ /**
+ * Returns the mapping version for this index definition.
+ * If the version is not specified, the default value is {@code 1.0.0}.
+ */
+ public String getMappingVersion() {
+ return getOptionalValue(definition, PROP_INDEX_MAPPING_VERSION, "1.0.0");
+ }
Review Comment:
Shouldn't the default value be a clearly invalid version, like 0.0.0? Because we will assume that 1.0.0 is a valid version, so it can create confusion in cases where the index is missing a version, we might assume wrongly that it has a version.
##########
oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexTest.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.index.elastic.index;
+
+import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.plugins.index.elastic.ElasticAbstractQueryTest;
+import org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder;
+import org.junit.Test;
+
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+
+public class ElasticIndexTest extends ElasticAbstractQueryTest {
+
+ @Test
+ public void indexStoresMappingVersion() throws Exception {
+ IndexDefinitionBuilder builder = createIndex("a").noAsync();
+ builder.indexRule("nt:base").property("a").propertyIndex();
+ Tree index = setIndex(UUID.randomUUID().toString(), builder);
+ root.commit();
+
+ assertEventually(() -> assertEquals(ElasticIndexHelper.MAPPING_VERSION,
+ getElasticIndexDefinition(index).getMappingVersion()));
+ }
Review Comment:
It is missing a test that sets the mapping version and checks that it returns the version that we set.
--
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] fabriziofortino merged pull request #1035: OAK-10365: introduce mapping version in elastic index definition
Posted by "fabriziofortino (via GitHub)" <gi...@apache.org>.
fabriziofortino merged PR #1035:
URL: https://github.com/apache/jackrabbit-oak/pull/1035
--
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] fabriziofortino commented on a diff in pull request #1035: OAK-10365: introduce mapping version in elastic index definition
Posted by "fabriziofortino (via GitHub)" <gi...@apache.org>.
fabriziofortino commented on code in PR #1035:
URL: https://github.com/apache/jackrabbit-oak/pull/1035#discussion_r1273447221
##########
oak-search-elastic/src/test/java/org/apache/jackrabbit/oak/plugins/index/elastic/index/ElasticIndexTest.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.index.elastic.index;
+
+import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.plugins.index.elastic.ElasticAbstractQueryTest;
+import org.apache.jackrabbit.oak.plugins.index.search.util.IndexDefinitionBuilder;
+import org.junit.Test;
+
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+
+public class ElasticIndexTest extends ElasticAbstractQueryTest {
+
+ @Test
+ public void indexStoresMappingVersion() throws Exception {
+ IndexDefinitionBuilder builder = createIndex("a").noAsync();
+ builder.indexRule("nt:base").property("a").propertyIndex();
+ Tree index = setIndex(UUID.randomUUID().toString(), builder);
+ root.commit();
+
+ assertEventually(() -> assertEquals(ElasticIndexHelper.MAPPING_VERSION,
+ getElasticIndexDefinition(index).getMappingVersion()));
+ }
Review Comment:
As in the comment above, the version is internal and cannot be configured in the index definition. In this test we just need to test the mapping version gets stored and is equal to the current mapping version (`ElasticIndexHelper.MAPPING_VERSION`).
--
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] fabriziofortino commented on a diff in pull request #1035: OAK-10365: introduce mapping version in elastic index definition
Posted by "fabriziofortino (via GitHub)" <gi...@apache.org>.
fabriziofortino commented on code in PR #1035:
URL: https://github.com/apache/jackrabbit-oak/pull/1035#discussion_r1273445678
##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticIndexDefinition.java:
##########
@@ -269,6 +274,14 @@ public boolean analyzerConfigSplitOnNumerics() {
return getOptionalValue(analyzersTree, SPLIT_ON_NUMERICS, false);
}
+ /**
+ * Returns the mapping version for this index definition.
+ * If the version is not specified, the default value is {@code 1.0.0}.
+ */
+ public String getMappingVersion() {
+ return getOptionalValue(definition, PROP_INDEX_MAPPING_VERSION, "1.0.0");
+ }
Review Comment:
The mapping version is internal and cannot be changed in the index definition (it's stored in a hidden property). If the index definition does not have a version, we return the base version currently set as `1.0.0`.
--
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