logic: search ui performance optimization

* replaced the implementation of the search index. the search index now uses a search-trie. edges have gates that can be used to check if a character can be matched when following the edge.
* SearchMatches now have a text and a list of NameHierarchies that share this node (instead of Ids, so that nodes must be found by names (which makes sure that SearchMatches are still valid after refresh).
* when parsing a project's description the CodeController now looks for NameHierarchies instead of SearchNode names to find ids of linked elements.
This commit is contained in:
malte_langkabel
2016-04-04 15:39:39 +02:00
parent ffc00829f0
commit f3dc12b0ed
21 changed files with 410 additions and 1367 deletions
+3 -8
View File
@@ -7,11 +7,11 @@
#include "utility/file/FilePath.h"
#include "data/access/StorageAccess.h"
#include "data/HierarchyCache.h"
#include "data/graph/token_component/TokenComponentAccess.h"
#include "data/location/TokenLocationCollection.h"
#include "data/parser/ParserClient.h"
#include "data/search/SearchIndex.h"
#include "data/HierarchyCache.h"
#include "data/SqliteStorage.h"
#include "data/parser/ParserClientImpl.h"
@@ -35,7 +35,6 @@ public:
void removeUnusedNames();
std::vector<FileInfo> getInfoOnAllFiles() const;
const SearchIndex& getSearchIndex() const;
void logStats() const;
@@ -46,7 +45,6 @@ public:
// StorageAccess implementation
virtual Id getIdForNodeWithNameHierarchy(const NameHierarchy& nameHierarchy) const;
virtual Id getIdForNodeWithSearchNameHierarchy(const NameHierarchy& nameHierarchy) const;
virtual Id getIdForEdge(
Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy) const;
@@ -56,7 +54,7 @@ public:
virtual Node::NodeType getNodeTypeForNodeWithId(Id nodeId) const;
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const;
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& tokenIds) const;
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& elementIds) const;
virtual std::shared_ptr<Graph> getGraphForAll() const;
virtual std::shared_ptr<Graph> getGraphForActiveTokenIds(const std::vector<Id>& tokenIds, bool activeOnly) const;
@@ -105,16 +103,13 @@ private:
void log(std::string type, std::string str, const ParseLocation& location) const;
SearchIndex m_tokenIndex;
SearchIndex m_commandIndex;
SearchIndex m_searchIndex;
SqliteStorage m_sqliteStorage;
mutable std::map <FilePath, Id> m_fileNodeIds;
HierarchyCache m_hierarchyCache;
mutable SearchResults m_cachedResults;
mutable std::string m_cachedQuery;
};
#endif // STORAGE_H