|
@@ -49,7 +49,7 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
|
|
// NOTE, when adding defaults here, make sure you add them in the builder
|
|
|
public static final String NULL_VALUE = null;
|
|
|
public static final int POSITION_OFFSET_GAP = 0;
|
|
|
- public static final int DEFAULT_LIMIT = -1;
|
|
|
+ public static final int IGNORE_ABOVE = -1;
|
|
|
}
|
|
|
|
|
|
public static class Builder extends AbstractFieldMapper.OpenBuilder<Builder, StringFieldMapper> {
|
|
@@ -60,7 +60,7 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
|
|
|
|
|
protected NamedAnalyzer searchQuotedAnalyzer;
|
|
|
|
|
|
- protected int limit = Defaults.DEFAULT_LIMIT;
|
|
|
+ protected int ignoreAbove = Defaults.IGNORE_ABOVE;
|
|
|
|
|
|
public Builder(String name) {
|
|
|
super(name);
|
|
@@ -97,8 +97,8 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
|
|
return builder;
|
|
|
}
|
|
|
|
|
|
- public Builder limit(int limit) {
|
|
|
- this.limit = limit;
|
|
|
+ public Builder ignoreAbove(int ignoreAbove) {
|
|
|
+ this.ignoreAbove = ignoreAbove;
|
|
|
return this;
|
|
|
}
|
|
|
|
|
@@ -111,7 +111,7 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
|
|
}
|
|
|
StringFieldMapper fieldMapper = new StringFieldMapper(buildNames(context),
|
|
|
index, store, termVector, boost, omitNorms, omitTermFreqAndPositions, nullValue,
|
|
|
- indexAnalyzer, searchAnalyzer, searchQuotedAnalyzer, positionOffsetGap, limit);
|
|
|
+ indexAnalyzer, searchAnalyzer, searchQuotedAnalyzer, positionOffsetGap, ignoreAbove);
|
|
|
fieldMapper.includeInAll(includeInAll);
|
|
|
return fieldMapper;
|
|
|
}
|
|
@@ -146,8 +146,8 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
|
|
if (builder.searchQuotedAnalyzer == null) {
|
|
|
builder.searchQuotedAnalyzer = parserContext.analysisService().defaultSearchQuoteAnalyzer();
|
|
|
}
|
|
|
- } else if (propName.equals("limit")) {
|
|
|
- builder.limit(XContentMapValues.nodeIntegerValue(propNode, -1));
|
|
|
+ } else if (propName.equals("ignore_above")) {
|
|
|
+ builder.ignoreAbove(XContentMapValues.nodeIntegerValue(propNode, -1));
|
|
|
}
|
|
|
}
|
|
|
return builder;
|
|
@@ -162,24 +162,24 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
|
|
|
|
|
private NamedAnalyzer searchQuotedAnalyzer;
|
|
|
|
|
|
- private int limit;
|
|
|
+ private int ignoreAbove;
|
|
|
|
|
|
protected StringFieldMapper(Names names, Field.Index index, Field.Store store, Field.TermVector termVector,
|
|
|
float boost, boolean omitNorms, boolean omitTermFreqAndPositions,
|
|
|
String nullValue, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer) {
|
|
|
this(names, index, store, termVector, boost, omitNorms, omitTermFreqAndPositions, nullValue, indexAnalyzer,
|
|
|
- searchAnalyzer, searchAnalyzer, Defaults.POSITION_OFFSET_GAP, Defaults.DEFAULT_LIMIT);
|
|
|
+ searchAnalyzer, searchAnalyzer, Defaults.POSITION_OFFSET_GAP, Defaults.IGNORE_ABOVE);
|
|
|
}
|
|
|
|
|
|
protected StringFieldMapper(Names names, Field.Index index, Field.Store store, Field.TermVector termVector,
|
|
|
float boost, boolean omitNorms, boolean omitTermFreqAndPositions,
|
|
|
String nullValue, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
|
|
|
- NamedAnalyzer searchQuotedAnalyzer, int positionOffsetGap, int limit) {
|
|
|
+ NamedAnalyzer searchQuotedAnalyzer, int positionOffsetGap, int ignoreAbove) {
|
|
|
super(names, index, store, termVector, boost, omitNorms, omitTermFreqAndPositions, indexAnalyzer, searchAnalyzer);
|
|
|
this.nullValue = nullValue;
|
|
|
this.positionOffsetGap = positionOffsetGap;
|
|
|
this.searchQuotedAnalyzer = searchQuotedAnalyzer != null ? searchQuotedAnalyzer : this.searchAnalyzer;
|
|
|
- this.limit = limit;
|
|
|
+ this.ignoreAbove = ignoreAbove;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -269,7 +269,7 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
|
|
if (value == null) {
|
|
|
return null;
|
|
|
}
|
|
|
- if (limit > 0 && value.length() > limit) {
|
|
|
+ if (ignoreAbove > 0 && value.length() > ignoreAbove) {
|
|
|
return null;
|
|
|
}
|
|
|
if (context.includeInAll(includeInAll, this)) {
|
|
@@ -331,8 +331,8 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
|
|
if (searchQuotedAnalyzer != null && searchAnalyzer != searchQuotedAnalyzer) {
|
|
|
builder.field("search_quote_analyzer", searchQuotedAnalyzer.name());
|
|
|
}
|
|
|
- if (limit != Defaults.DEFAULT_LIMIT) {
|
|
|
- builder.field("limit", limit);
|
|
|
+ if (ignoreAbove != Defaults.IGNORE_ABOVE) {
|
|
|
+ builder.field("ignore_above", ignoreAbove);
|
|
|
}
|
|
|
}
|
|
|
}
|