Skip to content

Commit e54f2e7

Browse files
author
sm-harding
committed
Throw error and fail if IndriBuildIndex reads build parameters with stemmer but no stemmer name definition.
git-svn-id: https://svn.code.sf.net/p/lemur/code/indri/trunk@2743 14020d50-3050-45fe-8e0c-5ed7005ca764
1 parent 5fb9783 commit e54f2e7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

buildindex/IndriBuildIndex.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,9 +973,22 @@ int main(int argc, char * argv[]) {
973973
env.setOffsetAnnotationIndexHint(indri::parse::OAHintDefault);
974974
}
975975

976-
std::string stemmerName = parameters.get("stemmer.name", "");
976+
/* std::string stemmerName = parameters.get("stemmer.name", "");
977977
if( stemmerName.length() )
978978
env.setStemmer(stemmerName);
979+
*/
980+
981+
//- Throw an error and fail if user specifies a stemmer without a <name> parameter.
982+
if (parameters.exists ("stemmer")) {
983+
std::string stemmerName = parameters.get("stemmer.name", "");
984+
985+
if( stemmerName.length() > 0)
986+
env.setStemmer(stemmerName);
987+
else {
988+
LEMUR_THROW (LEMUR_MISSING_PARAMETER_ERROR,
989+
"Stemmer name parameter not specified. Use <stemmer><name>stemmer_name</name></stemmer>");
990+
}
991+
}
979992

980993
std::vector<std::string> stopwords;
981994
if( copy_parameters_to_string_vector( stopwords, parameters, "stopper.word" ) )

0 commit comments

Comments
 (0)