本文整理汇总了C++中indri::api::Parameters::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ Parameters::remove方法的具体用法?C++ Parameters::remove怎么用?C++ Parameters::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indri::api::Parameters
的用法示例。
在下文中一共展示了Parameters::remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _mergeFields
void _mergeFields() {
if( repo.exists("field") ) {
indri::api::Parameters result;
indri::api::Parameters fields = repo["field"];
for (size_t i = 0; i < fields.size(); i++) {
indri::api::Parameters oldField = fields[i];
std::string fieldName = oldField["name"];
bool keep = true;
for (size_t j = 0; j < removeNames.size(); j++) {
if (removeNames[j] == fieldName) {
keep = false;
break;
}
}
if (keep) {
bool isNumeric = oldField.get("numeric", false);
bool isOrdinal = oldField.get("ordinal", false);
bool isParental = oldField.get("parental", false);
std::string parserName = oldField.get("parserName",
isNumeric ? "NumericFieldAnnotator" : "");
indri::api::Parameters field = result.append("field");
field.set( "name", fieldName );
field.set( "numeric", isNumeric );
field.set( "parserName", parserName );
field.set( "ordinal", isOrdinal );
field.set( "parental", isParental );
}
}
if (adding) {
indri::api::Parameters newFields = addFields["field"];
for (size_t i = 0; i < newFields.size(); i++) {
indri::api::Parameters newField = newFields[i];
std::string fieldName = newField["name"];
bool dupe = false;
for( size_t j = 0; j<fields.size(); j++ ) {
std::string parameterFieldName = fields[j]["name"];
if( parameterFieldName == fieldName ) {
// it's already in there, skip it...
dupe = true;
break;
}
}
if (dupe) continue;
bool isNumeric = newField.get("numeric", false);
bool isOrdinal = newField.get("ordinal", false);
bool isParental = newField.get("parental", false);
std::string parserName = newField.get("parserName",
isNumeric ? "OffsetAnnotationAnnotator" : "");
indri::api::Parameters field = result.append("field");
field.set( "name", fieldName );
field.set( "numeric", isNumeric );
field.set( "parserName", parserName );
field.set( "ordinal", isOrdinal );
field.set( "parental", isParental );
}
}
if (result.exists("field")) {
repo.set("field");
repo["field"] = result["field"];
} else {
// no fields in new index...
if (repo.exists("field")) {
repo.remove("field");
}
}
} else {
// no fields in original, just insert
// the new ones. (test they exist...)
if (adding) {
repo.set("field");
repo["field"] = addFields["field"];
}
}
}