Files
Sourcetrail/src/lib/data/StorageCache.cpp
T
Eberhard Graether 1b445d4c3a src: removed query syntax
This change removes the query syntax from the QtSmartSearchbox and all its classes. Now it only autocompletes to one
single Token, but the UI functionality for composing a query of multiple elements is still left for later use. The struct
SearchMatch is now used in the whole pipeline for passing search results back and forth.
2015-09-02 11:52:07 +02:00

24 lines
548 B
C++

#include "data/StorageCache.h"
void StorageCache::clear()
{
m_queryToTokenIds.clear();
}
std::vector<Id> StorageCache::getTokenIdsForMatches(const std::vector<SearchMatch>& matches) const
{
std::string query = SearchMatch::searchMatchesToString(matches);
std::map<std::string, std::vector<Id>>::const_iterator it = m_queryToTokenIds.find(query);
if (it != m_queryToTokenIds.end())
{
return it->second;
}
std::vector<Id> ids = StorageAccessProxy::getTokenIdsForMatches(matches);
m_queryToTokenIds.emplace(query, ids);
return ids;
}