20 wordPositionMap = _wordPositionMap;
24 std::map<
unsigned long long, std::vector<WordPos> > &wordMapPtr, std::map<unsigned int, WordPos> &wordOffsetMap)
29 typename std::map<unsigned long long, std::vector<WordPos> >::iterator it;
30 unsigned long long key = 0llu;
31 std::vector<HCE::CWords> cwords = outData->getCWords();
32 for(
unsigned int i = 0; i < cwords.size(); i++)
34 if(cwords[i].getWordType() != HCE::WORD_TYPE::WORD && cwords[i].getWordType() != HCE::WORD_TYPE::NUMBER)
38 key = crc64.
calc(cwords[i].getNormWord().c_str(), cwords[i].getNormWord().length());
39 if((it = wordMapPtr.find(key)) != wordMapPtr.end())
41 for(
unsigned int y = 0; y < (*it).second.size(); y++)
43 if(searchType == SearchType::ST_SINGLE)
46 (*it).second[y].segmentId = incrementalIndex;
47 wordOffsetMap.insert(std::pair<unsigned int, WordPos>((*it).second[y].beginOffset, (*it).second[y]));
49 else if(searchType == SearchType::ST_STRICKT || searchType == SearchType::ST_NO_STRICKT)
51 wordPositionMap.insert(std::pair<
unsigned int, std::pair<unsigned long long, WordPos> >
52 ((*it).second[y].position, std::pair<unsigned long long, WordPos>((*it).first, (*it).second[y])));
66 typename std::map<unsigned int, std::pair<unsigned long long, WordPos> >::iterator tempIt;
67 std::vector<HCE::CWords> cwords = outData->getCWords();
68 for(
unsigned int i = 0; i < cwords.size(); i++)
70 if(cwords[i].getWordType() != HCE::WORD_TYPE::WORD && cwords[i].getWordType() != HCE::WORD_TYPE::NUMBER)
74 notStricktChain.
addWord(crc64.
calc(cwords[i].getNormWord().c_str(), cwords[i].getNormWord().length()));
76 if(notStricktChain.
wCount() > 0)
78 auto prevIt = wordPositionMap.begin();
79 auto startChainIt = wordPositionMap.begin();
82 for(
auto it = wordPositionMap.begin(); it != wordPositionMap.end(); ++it)
84 if((*it).first != ((*prevIt).first + 1) || jump)
90 notStricktChain.
decrCount((*it).second.first);
94 for(tempIt = startChainIt; tempIt != it; ++tempIt)
96 (*tempIt).second.second.segmentId = incrementalIndex;
97 wordOffsetMap.insert(std::pair<unsigned int, WordPos>((*tempIt).second.second.beginOffset, (*tempIt).second.second));
99 (*it).second.second.segmentId = incrementalIndex;
100 wordOffsetMap.insert(std::pair<unsigned int, WordPos>((*it).second.second.beginOffset, (*it).second.second));
112 if(!outData.isNull())
115 typename std::map<unsigned int, std::pair<unsigned long long, WordPos> >::iterator localIt;
116 std::vector<HCE::CWords> cwords = outData->getCWords();
117 std::vector<unsigned long long> crcVec;
118 for(
unsigned int i = 0; i < cwords.size(); i++)
120 if(cwords[i].getWordType() != HCE::WORD_TYPE::WORD && cwords[i].getWordType() != HCE::WORD_TYPE::NUMBER)
124 crcVec.push_back(crc64.
calc(cwords[i].getNormWord().c_str(), cwords[i].getNormWord().length()));
126 if(crcVec.size() > 0)
129 unsigned int prevPos = 0;
131 bool isChain =
false;
132 for(
auto it = wordPositionMap.begin(); it != wordPositionMap.end(); ++it)
134 if((*it).second.first == crcVec[0])
137 prevPos = (*it).first;
140 for(
unsigned int i = 1; i < crcVec.size(); i++)
142 if(localIt == wordPositionMap.end() || ((*localIt).first != prevPos + 1) || ((*localIt).second.first != crcVec[i]))
147 prevPos = (*localIt).first;
153 for(
unsigned int i = 0; i < crcVec.size(); i++)
156 (*localIt).second.second.segmentId = incrementalIndex;
157 wordOffsetMap.insert(std::pair<unsigned int, WordPos>((*localIt).second.second.beginOffset, (*localIt).second.second));
169 unsigned int localSegmentId = 0xFFFFFFFF;
170 std::map<unsigned int, WordPos> localWordOffsetMap;
171 std::pair<std::map<unsigned int, WordPos>::iterator,
bool> insertIt;
172 for(
auto it = wordOffsetMap.begin(); it != wordOffsetMap.end(); ++it)
174 if(it->second.segmentId == localSegmentId)
176 insertIt.first->second.endOffset = it->second.endOffset;
180 insertIt = localWordOffsetMap.insert(std::pair<unsigned int, WordPos>(it->first, it->second));
182 localSegmentId = it->second.segmentId;
184 wordOffsetMap = localWordOffsetMap;
190 if(wordMapPtr.isNull() || wordMapPtr->empty())
194 wordPositionMap.clear();
195 for(
unsigned int i = 0; i < searchStrings.size(); i++)
197 if(!searchStrings[i].second.empty() && searchStrings[i].second.length() > 0)
199 std::map<unsigned long long, std::vector<WordPos> > &localWordPosMap = (searchStrings[i].first == SearchType::ST_SINGLE ? (*wordMapPtr)[1] : (*wordMapPtr)[0]);
201 Poco::SharedPtr<HCE::DataBase> inData =
nullptr;
202 Poco::SharedPtr<HCE::DataBase> outDataFindStr =
nullptr;
207 outDataFindStr = refine.
process(inData);
209 if(searchStrings[i].first == SearchType::ST_STRICKT)
213 else if(searchStrings[i].first == SearchType::ST_NO_STRICKT)