Apache Solr open-source search software
SOLR-3107: hardwire seed in langdetect langid impl
Robert Muir8b939cb7d201
diff --git a/solr/contrib/langid/CHANGES.txt b/solr/contrib/langid/CHANGES.txtindex 10873e15f09..3f78821aaa8 100644--- a/solr/contrib/langid/CHANGES.txt+++ b/solr/contrib/langid/CHANGES.txt@@ -9,7 +9,9 @@ $Id$================== Release 3.6.0 ==================-(No Changes)+* SOLR-3107: When using the LangDetect implementation of langid, set the random+ seed to 0, so that the same document is detected as the same language with+ the same probability every time. (Christian Moen via rmuir)================== Release 3.5.0 ==================diff --git a/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java b/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.javaindex dafcb550bf0..fd948685898 100644--- a/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java+++ b/solr/contrib/langid/src/java/org/apache/solr/update/processor/LangDetectLanguageIdentifierUpdateProcessorFactory.java@@ -119,8 +119,9 @@ public class LangDetectLanguageIdentifierUpdateProcessorFactory extends};public static synchronized void loadData() throws IOException, LangDetectException {- if (loaded)+ if (loaded) {return;+ }loaded = true;List<String> profileData = new ArrayList<String>();Charset encoding = Charset.forName("UTF-8");@@ -131,5 +132,6 @@ public class LangDetectLanguageIdentifierUpdateProcessorFactory extendsreader.close();}DetectorFactory.loadProfile(profileData);+ DetectorFactory.setSeed(0);}}