You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2012/10/31 10:04:04 UTC

svn commit: r1404042 - in /lucene/dev/trunk: lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java solr/CHANGES.txt

Author: dweiss
Date: Wed Oct 31 09:04:04 2012
New Revision: 1404042

URL: http://svn.apache.org/viewvc?rev=1404042&view=rev
Log:
SOLR-4007: Morfologik dictionaries not available in Solr field type
due to class loader lookup problems. (Lance Norskog, Dawid Weiss)


Modified:
    lucene/dev/trunk/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java
    lucene/dev/trunk/solr/CHANGES.txt

Modified: lucene/dev/trunk/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java?rev=1404042&r1=1404041&r2=1404042&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java (original)
+++ lucene/dev/trunk/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorfologikFilter.java Wed Oct 31 09:04:04 2012
@@ -67,9 +67,18 @@ public class MorfologikFilter extends To
   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() {

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1404042&r1=1404041&r2=1404042&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Wed Oct 31 09:04:04 2012
@@ -81,6 +81,9 @@ Optimizations
 Bug 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)