mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-07 21:48:39 +00:00
mark bool field type as not toknized
even though we use keyword analyzer for the bool type, we should mark it as not tokenized in the lucene field type as well, no reason to take it though analysis phase to begin with
This commit is contained in:
parent
012d47b500
commit
1a6514c413
@ -24,6 +24,7 @@ import org.apache.lucene.document.FieldType;
|
||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||
import org.apache.lucene.search.Filter;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||
import org.elasticsearch.common.Booleans;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.Strings;
|
||||
@ -60,6 +61,7 @@ public class BooleanFieldMapper extends AbstractFieldMapper<Boolean> {
|
||||
static {
|
||||
FIELD_TYPE.setOmitNorms(true);
|
||||
FIELD_TYPE.setIndexOptions(IndexOptions.DOCS_ONLY);
|
||||
FIELD_TYPE.setTokenized(false);
|
||||
FIELD_TYPE.freeze();
|
||||
}
|
||||
|
||||
@ -85,6 +87,14 @@ public class BooleanFieldMapper extends AbstractFieldMapper<Boolean> {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Builder tokenized(boolean tokenized) {
|
||||
if (tokenized) {
|
||||
throw new ElasticSearchIllegalArgumentException("bool field can't be tokenized");
|
||||
}
|
||||
return super.tokenized(tokenized);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BooleanFieldMapper build(BuilderContext context) {
|
||||
return new BooleanFieldMapper(buildNames(context), boost, fieldType, nullValue, provider, similarity, fieldDataSettings);
|
||||
|
Loading…
x
Reference in New Issue
Block a user