Apache Solr open-source search software
SOLR-2934: increase buffer size for recent dictionaries with large amounts of AF/AM lines before charset
Robert Muirb670831559cd
diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.javaindex 1d3e60b970c..974d24185db 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java@@ -154,9 +154,11 @@ public class Dictionary {this.ignoreCase = ignoreCase;this.needsInputCleaning = ignoreCase;this.needsOutputCleaning = false; // set if we have an OCONV- // hungarian has thousands of AF before the SET, so a 32k buffer is needed- BufferedInputStream buffered = new BufferedInputStream(affix, 32768);- buffered.mark(32768);+ // TODO: we really need to probably buffer this on disk since so many newer dictionaries+ // (en_GB, hu_HU, etc) now have tons of AM lines (morph metadata) etc before they finally declare+ // their encoding... but for now this large buffer is a workaround+ BufferedInputStream buffered = new BufferedInputStream(affix, 65536);+ buffered.mark(65536);String encoding = getDictionaryEncoding(buffered);buffered.reset();CharsetDecoder decoder = getJavaEncoding(encoding);