Apache Solr open-source search software
SOLR-4007: Morfologik dictionaries not available in Solr field type due to class loader lookup problems. (Lance Norskog, Dawid Weiss)
Dawid Weiss847bb71cdfb6
diff --git a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.javaindex 16ca41e5e53..5be56d2fd06 100644--- a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java+++ b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java@@ -67,9 +67,18 @@ public class MorfologikFilter extends TokenFilter {public MorfologikFilter(final TokenStream in, final DICTIONARY dict, final Version version) {super(in);this.input = in;- this.stemmer = new PolishStemmer(dict);- this.charUtils = CharacterUtils.getInstance(version);- this.lemmaList = Collections.emptyList();++ // SOLR-4007: temporarily substitute context class loader to allow finding dictionary resources.+ Thread me = Thread.currentThread();+ ClassLoader cl = me.getContextClassLoader();+ try {+ me.setContextClassLoader(PolishStemmer.class.getClassLoader());+ this.stemmer = new PolishStemmer(dict);+ this.charUtils = CharacterUtils.getInstance(version);+ this.lemmaList = Collections.emptyList();+ } finally {+ me.setContextClassLoader(cl);+ }}private void popNextLemma() {diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex b890cb7d909..5d1b3faaf84 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -81,6 +81,9 @@ OptimizationsBug Fixes----------------------+* SOLR-4007: Morfologik dictionaries not available in Solr field type+ due to class loader lookup problems. (Lance Norskog, Dawid Weiss)+* SOLR-3560: Handle different types of Exception Messages for Logging UI(steffkes)