Apache Solr open-source search software
Remove redundant fieldType.stored() check during indexing (#2076)
Shintaro Murakamid1297e52d91d
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexingChain.java b/lucene/core/src/java/org/apache/lucene/index/IndexingChain.javaindex c20a453d869..03d5aea7ab6 100644--- a/lucene/core/src/java/org/apache/lucene/index/IndexingChain.java+++ b/lucene/core/src/java/org/apache/lucene/index/IndexingChain.java@@ -584,17 +584,15 @@ final class IndexingChain implements Accountable {if (fp == null) {fp = getOrAddField(fieldName, fieldType, false);}- if (fieldType.stored()) {- String value = field.stringValue();- if (value != null && value.length() > IndexWriter.MAX_STORED_STRING_LENGTH) {- throw new IllegalArgumentException("stored field \"" + field.name() + "\" is too large (" + value.length() + " characters) to store");- }- try {- storedFieldsConsumer.writeField(fp.fieldInfo, field);- } catch (Throwable th) {- onAbortingException(th);- throw th;- }+ String value = field.stringValue();+ if (value != null && value.length() > IndexWriter.MAX_STORED_STRING_LENGTH) {+ throw new IllegalArgumentException("stored field \"" + field.name() + "\" is too large (" + value.length() + " characters) to store");+ }+ try {+ storedFieldsConsumer.writeField(fp.fieldInfo, field);+ } catch (Throwable th) {+ onAbortingException(th);+ throw th;}}