Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAK-10672: move internal index version in oak-search #1327

Merged
merged 3 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexDefinition;
import org.apache.jackrabbit.oak.plugins.index.elastic.ElasticPropertyDefinition;
import org.apache.jackrabbit.oak.plugins.index.search.FieldNames;
import org.apache.jackrabbit.oak.plugins.index.search.FulltextIndexConstants;
import org.apache.jackrabbit.oak.plugins.index.search.PropertyDefinition;
import org.jetbrains.annotations.NotNull;

Expand All @@ -52,8 +53,17 @@ class ElasticIndexHelper {
* Changes not breaking compatibility should increment the minor version (old queries still work, but they might not
* use the new feature).
* Changes that do not affect queries should increment the patch version (eg: bug fixes).
* <p>
* WARN: Since this information might be needed from external tools that don't have a direct dependency on this module, the
* actual version needs to be set in oak-search.
*/
protected static final String MAPPING_VERSION = "1.1.0";
protected static final String MAPPING_VERSION;
static {
MAPPING_VERSION = FulltextIndexConstants.INDEX_VERSION_BY_TYPE.get(ElasticIndexDefinition.TYPE_ELASTICSEARCH);
if (MAPPING_VERSION == null) {
throw new IllegalStateException("Mapping version is not set");
}
}

// Unset the refresh interval and disable replicas at index creation to optimize for initial loads
// https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-indexing-speed.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.jackrabbit.oak.plugins.index.search;

import java.util.Locale;
import java.util.Map;

/**
* Internal constants used in index definition, and index implementations.
Expand Down Expand Up @@ -77,7 +78,7 @@ public static IndexingMode from(String indexingMode) {
/**
* Type of the property being indexed defined as part of property definition
* under the given index definition. Refer to {@link javax.jcr.PropertyType}
* contants for the possible values
* constants for the possible values
*/
String PROP_TYPE = "type";

Expand Down Expand Up @@ -196,7 +197,7 @@ public static IndexingMode from(String indexingMode) {

/**
* Limit for maximum number of reaggregates allowed. For example if there is an aggregate of nt:folder
* and it also includes nt:folder then aggregation would traverse down untill this limit is hit
* and it also includes nt:folder then aggregation would traverse down until this limit is hit
*/
String AGG_RECURSIVE_LIMIT = "reaggregateLimit";

Expand Down Expand Up @@ -436,4 +437,12 @@ public static IndexingMode from(String indexingMode) {
* Boolean property indicating if in-built analyzer should preserve original term
*/
String INDEX_ORIGINAL_TERM = "indexOriginalTerm";

/**
* Internal version of the index definition for specific index type. Index version is an information that might be
* needed from an outside process that does not have visibility to the specific index module.
*/
Map<String, String> INDEX_VERSION_BY_TYPE = Map.of(
"elasticsearch", "1.1.0"
fabriziofortino marked this conversation as resolved.
Show resolved Hide resolved
);
}
Loading