Term Vector settings should be treated like flags without propergation

today if a specific feature is disabled for term vectors with something
like 'store_term_vector_positions = false' term vectors might be disabeled
alltogether even if 'store_term_vectors=true' in the mapping. This depends on the
order of the values in the mapping since the more specific one might override
the less specific on.

Closes #4582
This commit is contained in:
Simon Willnauer 2014-01-02 12:20:12 +01:00
parent c12427d047
commit 79f676e45e
1 changed files with 12 additions and 4 deletions

View File

@ -117,24 +117,32 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T> {
}
public T storeTermVectors(boolean termVectors) {
this.fieldType.setStoreTermVectors(termVectors);
if (termVectors) {
this.fieldType.setStoreTermVectors(termVectors);
} // don't set it to false, it is default and might be flipped by a more specific option
return builder;
}
public T storeTermVectorOffsets(boolean termVectorOffsets) {
this.fieldType.setStoreTermVectors(termVectorOffsets);
if (termVectorOffsets) {
this.fieldType.setStoreTermVectors(termVectorOffsets);
}
this.fieldType.setStoreTermVectorOffsets(termVectorOffsets);
return builder;
}
public T storeTermVectorPositions(boolean termVectorPositions) {
this.fieldType.setStoreTermVectors(termVectorPositions);
if (termVectorPositions) {
this.fieldType.setStoreTermVectors(termVectorPositions);
}
this.fieldType.setStoreTermVectorPositions(termVectorPositions);
return builder;
}
public T storeTermVectorPayloads(boolean termVectorPayloads) {
this.fieldType.setStoreTermVectors(termVectorPayloads);
if (termVectorPayloads) {
this.fieldType.setStoreTermVectors(termVectorPayloads);
}
this.fieldType.setStoreTermVectorPayloads(termVectorPayloads);
return builder;
}