Skip to content

Commit

Permalink
removing unnecessary setting
Browse files Browse the repository at this point in the history
  • Loading branch information
benwtrent committed Jun 18, 2024
1 parent d441cb5 commit 4c6d17b
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,22 @@
package org.elasticsearch.analysis.common;

import org.apache.lucene.analysis.TokenStream;
import org.elasticsearch.common.logging.DeprecationCategory;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.IndexVersions;
import org.elasticsearch.index.analysis.AbstractTokenFilterFactory;

public class UniqueTokenFilterFactory extends AbstractTokenFilterFactory {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(UniqueTokenFilterFactory.class);

static final String ONLY_ON_SAME_POSITION = "only_on_same_position";
static final String CORRECT_POSITION_INCREMENT = "correct_position_increment";
private final boolean onlyOnSamePosition;
private final boolean correctPositionIncrement;

UniqueTokenFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
super(name, settings);
this.onlyOnSamePosition = settings.getAsBoolean(ONLY_ON_SAME_POSITION, false);
this.correctPositionIncrement = settings.getAsBoolean(
CORRECT_POSITION_INCREMENT,
indexSettings.getIndexVersionCreated().onOrAfter(IndexVersions.UNIQUE_TOKEN_FILTER_POS_FIX)
);
if (settings.hasValue(CORRECT_POSITION_INCREMENT)) {
deprecationLogger.warn(
DeprecationCategory.ANALYSIS,
"unique_token_filter_position_fix",
"The setting [correct_position_increment] is deprecated and enabled by default. It will be removed in a future version."
);
}
this.correctPositionIncrement = indexSettings.getIndexVersionCreated().onOrAfter(IndexVersions.UNIQUE_TOKEN_FILTER_POS_FIX);
}

@Override
Expand Down

0 comments on commit 4c6d17b

Please sign in to comment.