Mapping: Allow to have for a field to not be stored and not indexed, but still be included in `all`, closes #90.
This commit is contained in:
parent
5957f580e3
commit
9c0a37df32
|
@ -119,6 +119,9 @@ public class JsonBooleanFieldMapper extends JsonFieldMapper<Boolean> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected Field parseCreateField(JsonParseContext jsonContext) throws IOException {
|
@Override protected Field parseCreateField(JsonParseContext jsonContext) throws IOException {
|
||||||
|
if (!indexed() && !stored()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
JsonToken token = jsonContext.jp().getCurrentToken();
|
JsonToken token = jsonContext.jp().getCurrentToken();
|
||||||
String value = null;
|
String value = null;
|
||||||
if (token == JsonToken.VALUE_FALSE) {
|
if (token == JsonToken.VALUE_FALSE) {
|
||||||
|
|
|
@ -267,9 +267,6 @@ public abstract class JsonFieldMapper<T> implements FieldMapper<T>, JsonMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void parse(JsonParseContext jsonContext) throws IOException {
|
@Override public void parse(JsonParseContext jsonContext) throws IOException {
|
||||||
if (!indexed() && !stored()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Field field = parseCreateField(jsonContext);
|
Field field = parseCreateField(jsonContext);
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -109,6 +109,9 @@ public class JsonStringFieldMapper extends JsonFieldMapper<String> implements Js
|
||||||
if (includeInAll == null || includeInAll) {
|
if (includeInAll == null || includeInAll) {
|
||||||
jsonContext.allEntries().addText(names.fullName(), value, boost);
|
jsonContext.allEntries().addText(names.fullName(), value, boost);
|
||||||
}
|
}
|
||||||
|
if (!indexed() && !stored()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return new Field(names.indexName(), value, store, index, termVector);
|
return new Field(names.indexName(), value, store, index, termVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue