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:
kimchy 2010-03-25 20:56:45 +02:00
parent 5957f580e3
commit 9c0a37df32
3 changed files with 6 additions and 3 deletions

View File

@ -119,6 +119,9 @@ public class JsonBooleanFieldMapper extends JsonFieldMapper<Boolean> {
}
@Override protected Field parseCreateField(JsonParseContext jsonContext) throws IOException {
if (!indexed() && !stored()) {
return null;
}
JsonToken token = jsonContext.jp().getCurrentToken();
String value = null;
if (token == JsonToken.VALUE_FALSE) {

View File

@ -267,9 +267,6 @@ public abstract class JsonFieldMapper<T> implements FieldMapper<T>, JsonMapper {
}
@Override public void parse(JsonParseContext jsonContext) throws IOException {
if (!indexed() && !stored()) {
return;
}
Field field = parseCreateField(jsonContext);
if (field == null) {
return;

View File

@ -109,6 +109,9 @@ public class JsonStringFieldMapper extends JsonFieldMapper<String> implements Js
if (includeInAll == null || includeInAll) {
jsonContext.allEntries().addText(names.fullName(), value, boost);
}
if (!indexed() && !stored()) {
return null;
}
return new Field(names.indexName(), value, store, index, termVector);
}