logic: preselecting SearchNodes for autocompletion by prefiltering the Graph with the entered Query
This change only shows matches in the autocompletion list that are prefiltered by the already entered query. The autocompletion now also shows up after an operator of type . or > has been entered to show an alphabetical list of possible tokens.
This commit is contained in:
@@ -11,6 +11,11 @@ FilterableGraph::~FilterableGraph()
|
||||
{
|
||||
}
|
||||
|
||||
size_t FilterableGraph::size() const
|
||||
{
|
||||
return getNodeCount() + getEdgeCount();
|
||||
}
|
||||
|
||||
Token* FilterableGraph::getTokenById(Id id) const
|
||||
{
|
||||
Token* token = getNodeById(id);
|
||||
|
||||
@@ -34,6 +34,8 @@ public:
|
||||
virtual Node* getNodeById(Id id) const = 0;
|
||||
virtual Edge* getEdgeById(Id id) const = 0;
|
||||
|
||||
size_t size() const;
|
||||
|
||||
Token* getTokenById(Id id) const;
|
||||
|
||||
void print(std::ostream& ostream) const;
|
||||
|
||||
@@ -64,6 +64,16 @@ std::string Node::getFullName() const
|
||||
return m_nameComponent->getFullName();
|
||||
}
|
||||
|
||||
const TokenComponentName* Node::getTokenComponentName() const
|
||||
{
|
||||
if (m_nameComponent)
|
||||
{
|
||||
return m_nameComponent.get();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::vector<Edge*>& Node::getEdges() const
|
||||
{
|
||||
return m_edges;
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
|
||||
std::string getName() const;
|
||||
std::string getFullName() const;
|
||||
const TokenComponentName* getTokenComponentName() const;
|
||||
|
||||
const std::vector<Edge*>& getEdges() const;
|
||||
|
||||
|
||||
@@ -91,6 +91,16 @@ Edge* SubGraph::getEdgeById(Id id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::map<Id, Node*>& SubGraph::getNodes() const
|
||||
{
|
||||
return m_nodes;
|
||||
}
|
||||
|
||||
const std::map<Id, Edge*>& SubGraph::getEdges() const
|
||||
{
|
||||
return m_edges;
|
||||
}
|
||||
|
||||
std::vector<Id> SubGraph::getTokenIds() const
|
||||
{
|
||||
std::vector<Id> ids;
|
||||
|
||||
@@ -37,6 +37,9 @@ public:
|
||||
virtual Node* getNodeById(Id id) const;
|
||||
virtual Edge* getEdgeById(Id id) const;
|
||||
|
||||
const std::map<Id, Node*>& getNodes() const;
|
||||
const std::map<Id, Edge*>& getEdges() const;
|
||||
|
||||
std::vector<Id> getTokenIds() const;
|
||||
|
||||
void subtract(const SubGraph& other);
|
||||
|
||||
@@ -40,6 +40,10 @@ std::string TokenComponentNameReferenced::getFullName() const
|
||||
return m_searchNode->getFullName();
|
||||
}
|
||||
|
||||
const SearchIndex::SearchNode* TokenComponentNameReferenced::getSearchNode() const
|
||||
{
|
||||
return m_searchNode;
|
||||
}
|
||||
|
||||
TokenComponentNameCached::TokenComponentNameCached(const std::string& fullName)
|
||||
: m_fullName(fullName)
|
||||
@@ -64,3 +68,8 @@ std::string TokenComponentNameCached::getFullName() const
|
||||
{
|
||||
return m_fullName;
|
||||
}
|
||||
|
||||
const SearchIndex::SearchNode* TokenComponentNameCached::getSearchNode() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ public:
|
||||
|
||||
virtual std::string getName() const = 0;
|
||||
virtual std::string getFullName() const = 0;
|
||||
|
||||
virtual const SearchIndex::SearchNode* getSearchNode() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -32,6 +34,8 @@ public:
|
||||
virtual std::string getName() const;
|
||||
virtual std::string getFullName() const;
|
||||
|
||||
virtual const SearchIndex::SearchNode* getSearchNode() const;
|
||||
|
||||
private:
|
||||
const SearchIndex::SearchNode* m_searchNode;
|
||||
};
|
||||
@@ -49,6 +53,8 @@ public:
|
||||
virtual std::string getName() const;
|
||||
virtual std::string getFullName() const;
|
||||
|
||||
virtual const SearchIndex::SearchNode* getSearchNode() const;
|
||||
|
||||
private:
|
||||
const std::string m_fullName;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user