本文整理汇总了C++中TrieNode::isTerminalNode方法的典型用法代码示例。如果您正苦于以下问题:C++ TrieNode::isTerminalNode方法的具体用法?C++ TrieNode::isTerminalNode怎么用?C++ TrieNode::isTerminalNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrieNode
的用法示例。
在下文中一共展示了TrieNode::isTerminalNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _deleteRecordGetInternalId
// delete a record with a specific id //TODO Give the correct return message for delete pass/fail
// get the deleted internal recordID
INDEXWRITE_RETVAL IndexData::_deleteRecordGetInternalId(
const std::string &externalRecordId, unsigned &internalRecordId) {
bool hasRecord =
this->forwardIndex->getInternalRecordIdFromExternalRecordId(
externalRecordId, internalRecordId);
if (hasRecord) {
ForwardList* forwardList =
this->forwardIndex->getForwardList_ForCommit(
internalRecordId);
this->permissionMap->deleteResourceFromRoles(externalRecordId, forwardList->getAccessList()->getRoles());
if (this->schemaInternal->getIndexType()
== srch2::instantsearch::LocationIndex) {
StoredRecordBuffer buffer = forwardList->getInMemoryData();
Schema * storedSchema = Schema::create();
srch2::util::RecordSerializerUtil::populateStoredSchema(
storedSchema, this->getSchema());
srch2::util::RecordSerializer compactRecDeserializer =
srch2::util::RecordSerializer(*storedSchema);
// get the name of the attributes
const string* nameOfLatitudeAttribute =
this->getSchema()->getNameOfLatituteAttribute();
const string* nameOfLongitudeAttribute =
this->getSchema()->getNameOfLongitudeAttribute();
unsigned idLat = storedSchema->getRefiningAttributeId(
*nameOfLatitudeAttribute);
unsigned latOffset = compactRecDeserializer.getRefiningOffset(
idLat);
unsigned idLong = storedSchema->getRefiningAttributeId(
*nameOfLongitudeAttribute);
unsigned longOffset = compactRecDeserializer.getRefiningOffset(
idLong);
Point point;
point.x = *((float *) (buffer.start.get() + latOffset));
point.y = *((float *) (buffer.start.get() + longOffset));
this->quadTree->remove_ThreadSafe(point, internalRecordId);
}
}
INDEXWRITE_RETVAL success =
this->forwardIndex->deleteRecord(externalRecordId) ?
OP_SUCCESS : OP_FAIL;
if (success == OP_SUCCESS) {
ForwardList * fwdList = this->forwardIndex->getForwardList_ForCommit(internalRecordId);
if (fwdList) {
unsigned keywordsCount = fwdList->getNumberOfKeywords();
const unsigned * listofKeywordIds = fwdList->getKeywordIds();
// Loop over the keyword-ids for the current forward list and get
// the inverted-list-ids from the trie.
TrieNodePath trieNodePath;
trieNodePath.path = new vector<TrieNode *>();
// first id: invertedListId; second id: keywordId
vector<pair<unsigned, unsigned> > invertedListIdsToMerge;
for (unsigned i = 0; i < keywordsCount; ++i) {
unsigned keywordId = *(listofKeywordIds + i);
// get the TrieNode path of the current keyword in write view based on its id.
this->trie->getKeywordCorrespondingPathToTrieNode_WriteView(keywordId, &trieNodePath);
if (trieNodePath.path->size() == 0) {
// should not happen.
ASSERT(false);
continue;
}
TrieNode * leafNode = trieNodePath.path->back();
if(leafNode && leafNode->isTerminalNode()) {
invertedListIdsToMerge.push_back(make_pair(leafNode->invertedListOffset, leafNode->id));
} else {
// should not happen.
ASSERT(false);
}
trieNodePath.path->clear();
}
delete trieNodePath.path;
this->invertedIndex->appendInvertedListKeywordIdsForMerge(invertedListIdsToMerge);
}
this->mergeRequired = true; // need to tell the merge thread to merge
this->writeCounter->decDocsCounter();
this->writeCounter->incWritesCounter();
}
return success;
}