Beispiel #1
0
void SummarizerFunctionInstanceListMatches::addNumericParameter( const std::string& name, const NumericVariant& val)
{
	if (utils::caseInsensitiveEquals( name, "match"))
	{
		m_errorhnd->report( _TXT("parameter '%s' for summarizer '%s' expected to be defined as feature and not as numeric value"), name.c_str(), "matchpos");
	}
	else if (utils::caseInsensitiveEquals( name, "name"))
	{
		m_errorhnd->report( _TXT("parameter '%s' for summarizer '%s' expected to be defined as string and not as numeric value"), name.c_str(), "matchpos");
	}
	else if (utils::caseInsensitiveEquals( name, "N"))
	{
		m_maxNofMatches = val.touint();
	}
	else
	{
		m_errorhnd->report( _TXT("unknown '%s' summarization function parameter '%s'"), "matchpos", name.c_str());
	}
}
void SummarizerFunctionInstanceForwardIndex::addNumericParameter( const std::string& name, const NumericVariant& val)
{
	if (strus::caseInsensitiveEquals( name, "name"))
	{
		m_errorhnd->report( ErrorCodeInvalidArgument, _TXT("parameter '%s' for summarizer '%s' expected to be defined as string and not as numeric value"), name.c_str(), THIS_METHOD_NAME);
	}
	else if (strus::caseInsensitiveEquals( name, "type"))
	{
		m_errorhnd->report( ErrorCodeInvalidArgument, _TXT("parameter '%s' for summarizer '%s' expected to be defined as string and not as numeric value"), name.c_str(), THIS_METHOD_NAME);
	}
	else if (strus::caseInsensitiveEquals( name, "N"))
	{
		m_maxNofMatches = std::min(
			val.touint(),
			(NumericVariant::UIntType)std::numeric_limits<unsigned int>::max());
	}
	else
	{
		m_errorhnd->report( ErrorCodeUnknownIdentifier, _TXT("unknown '%s' summarization function parameter '%s'"), THIS_METHOD_NAME, name.c_str());
	}
}