logic: random fixes and improvements
* added new logos to setup ui * changed wording in status messages and bundle nodes * removed ununsed Vector.h * save NameHierarchy to SearchMatch * fixed NameHierarchyElement retrieval for name elements without parent * fixed match weight to score last letters higher
This commit is contained in:
@@ -79,6 +79,18 @@ SearchNode* SearchIndex::addNode(NameHierarchy nameHierarchy)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SearchNode* SearchIndex::getNode(const NameHierarchy& nameHierarchy) const
|
||||
{
|
||||
std::deque<Id> nameIds = m_dictionary.getWordIdsConst(nameHierarchy);
|
||||
|
||||
if (nameIds.size())
|
||||
{
|
||||
return m_root.getNodeRecursive(&nameIds).get();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SearchNode* SearchIndex::getNode(const std::string& fullName) const
|
||||
{
|
||||
std::deque<Id> nameIds = m_dictionary.getWordIdsConst(fullName, DELIMITER);
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
const std::string& getWord(Id wordId) const;
|
||||
|
||||
SearchNode* addNode(NameHierarchy nameHierarchy);
|
||||
SearchNode* getNode(const NameHierarchy& nameHierarchy) const;
|
||||
SearchNode* getNode(const std::string& fullName) const;
|
||||
SearchNode* getNode(const SearchNode* searchNode) const;
|
||||
|
||||
|
||||
@@ -38,21 +38,20 @@ std::string SearchMatch::searchMatchesToString(const std::vector<SearchMatch>& m
|
||||
|
||||
for (size_t i = 0; i < matches.size(); i++)
|
||||
{
|
||||
ss << '@' << matches[i].fullName;
|
||||
ss << '@' << matches[i].getFullName();
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
SearchMatch::SearchMatch()
|
||||
: fullName("")
|
||||
, typeName("")
|
||||
: typeName("")
|
||||
, searchType(SEARCH_NONE)
|
||||
{
|
||||
}
|
||||
|
||||
SearchMatch::SearchMatch(const std::string& query)
|
||||
: fullName(query)
|
||||
: nameHierarchy(query)
|
||||
, typeName("")
|
||||
, searchType(SEARCH_NONE)
|
||||
{
|
||||
@@ -65,7 +64,7 @@ bool SearchMatch::isValid() const
|
||||
|
||||
void SearchMatch::print(std::ostream& ostream) const
|
||||
{
|
||||
ostream << weight << '\t' << fullName << std::endl << '\t';
|
||||
ostream << weight << '\t' << nameHierarchy.getFullName() << std::endl << '\t';
|
||||
size_t i = 0;
|
||||
for (size_t index : indices)
|
||||
{
|
||||
@@ -80,6 +79,11 @@ void SearchMatch::print(std::ostream& ostream) const
|
||||
ostream << std::endl;
|
||||
}
|
||||
|
||||
std::string SearchMatch::getFullName() const
|
||||
{
|
||||
return nameHierarchy.getFullName();
|
||||
}
|
||||
|
||||
std::string SearchMatch::getNodeTypeAsString() const
|
||||
{
|
||||
return Node::getTypeString(nodeType);
|
||||
|
||||
@@ -31,10 +31,11 @@ struct SearchMatch
|
||||
|
||||
void print(std::ostream& ostream) const;
|
||||
|
||||
std::string getFullName() const;
|
||||
std::string getNodeTypeAsString() const;
|
||||
std::string getSearchTypeName() const;
|
||||
|
||||
std::string fullName;
|
||||
NameHierarchy nameHierarchy;
|
||||
std::string typeName;
|
||||
|
||||
Node::NodeType nodeType;
|
||||
|
||||
@@ -255,7 +255,7 @@ void SearchNode::removeSearchNode(SearchNode* node)
|
||||
SearchMatch SearchNode::fuzzyMatchData(const std::string& query, const SearchNode* parent) const
|
||||
{
|
||||
SearchMatch data;
|
||||
data.fullName = getFullName();
|
||||
data.nameHierarchy = getNameHierarchy();
|
||||
data.tokenIds = m_tokenIds;
|
||||
data.weight = 0;
|
||||
|
||||
@@ -364,7 +364,7 @@ std::pair<size_t, size_t> SearchNode::fuzzyMatch(
|
||||
weight += 20;
|
||||
}
|
||||
|
||||
if (last == '_' || next == '_')
|
||||
if (last == '_' || next == '_' || next == '\0')
|
||||
{
|
||||
weight += 20;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user