本文整理汇总了C++中IndexReader::hasField方法的典型用法代码示例。如果您正苦于以下问题:C++ IndexReader::hasField方法的具体用法?C++ IndexReader::hasField怎么用?C++ IndexReader::hasField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IndexReader
的用法示例。
在下文中一共展示了IndexReader::hasField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initIncManager
/**
* 将IncManger中的,的字段处理策略初始化
*
* @param node 在配置文件中的 xml 节点 update_add2Modify
*
* @return 0: success ; -1: 程序处理失败
*/
int initIncManager( mxml_node_t * node )
{
if ( NULL == node ) return 0;
mxml_node_t * field = NULL;
IndexReader * reader = IndexReader::getInstance();
IncManager * incMgr = IncManager::getInstance();
ProfileDocAccessor * pflAcr = ProfileManager::getDocAccessor();
field = mxmlFindElement( node, node, "index_field", NULL, NULL, MXML_DESCEND_FIRST );
while ( field != NULL )
{
const char * name = mxmlElementGetAttr( field, "name" );
const char * proc = mxmlElementGetAttr( field, "proc" );
if ( ( NULL == name ) || (0 == strlen(name)) )
{
TERR("update_add2Modify: must have field name");
return -1;
}
if ( ( NULL == proc ) || (0 == strlen(proc)) )
{
TERR("update_add2Modify: must have proc: depend or ignore");
return -1;
}
if ( false == reader->hasField( name ) )
{
TWARN("update_add2Modify: can't find field in index:%s, are you sure", name);
}
if ( 0 == strcmp( proc , "ignore" ) )
{
if ( false == incMgr->addIgnIdxField( name ) )
{
TERR("update_add2Modify: add ignore field to incManager failed:%s", name);
return -1;
}
}
else if ( 0 == strcmp( proc , "depend" ) )
{
const char * pflFieldName = mxmlElementGetAttr( field, "profile_field" );
if ( ( NULL == pflFieldName ) || (0 == strlen(pflFieldName)) )
{
TERR("update_add2Modify: field:%s must have profile_field", name);
return -1;
}
if ( NULL == pflAcr->getProfileField( pflFieldName ) )
{
TERR("update_add2Modify: can't find field in profile:%s", pflFieldName);
return -1;
}
if ( false == incMgr->addIgnIdxField( name ) )
{
TERR("update_add2Modify: add ignore field to incManager failed:%s", name);
return -1;
}
if ( false == incMgr->addDepPflField( pflFieldName ) )
{
TERR("update_add2Modify: add depend pfl field to incManager failed:%s", pflFieldName);
return -1;
}
}
else
{
TERR("update_add2Modify: field:%s proc must be depend or ignore", name);
return -1;
}
field = mxmlFindElement( field, node, "index_field", NULL, NULL, MXML_NO_DESCEND );
}
return 0;
}