[sword-svn] r3271 - trunk/src/modules
scribe at crosswire.org
scribe at crosswire.org
Sat Oct 11 14:12:39 MST 2014
Author: scribe
Date: 2014-10-11 14:12:39 -0700 (Sat, 11 Oct 2014)
New Revision: 3271
Modified:
trunk/src/modules/swmodule.cpp
Log:
added attempt at correct stemmer.
Xapian has a Stem::get_available_languages() method but it returns full
language names like 'english' and 'french', not the codes we use. It
supposedly does ok with either, so we try and catch any exception and
ignore, not setting a stemmer if the language is not recognized.
Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp 2014-10-11 17:22:51 UTC (rev 3270)
+++ trunk/src/modules/swmodule.cpp 2014-10-11 21:12:39 UTC (rev 3271)
@@ -476,7 +476,9 @@
Xapian::Database database(target.c_str());
Xapian::QueryParser queryParser;
queryParser.set_default_op(Xapian::Query::OP_AND);
- queryParser.set_stemmer(Xapian::Stem("en"));
+ SWTRY {
+ queryParser.set_stemmer(Xapian::Stem(getLanguage()));
+ } SWCATCH(...) {}
queryParser.set_stemming_strategy(queryParser.STEM_SOME);
queryParser.add_prefix("content", "C");
queryParser.add_prefix("lemma", "L");
@@ -1121,7 +1123,9 @@
#if defined USEXAPIAN
Xapian::WritableDatabase database(target.c_str(), Xapian::DB_CREATE_OR_OPEN);
Xapian::TermGenerator termGenerator;
- termGenerator.set_stemmer(Xapian::Stem("en"));
+ SWTRY {
+ termGenerator.set_stemmer(Xapian::Stem(getLanguage()));
+ } SWCATCH(...) {}
#elif defined USELUCENE
RAMDirectory *ramDir = 0;
More information about the sword-cvs
mailing list