Skip to content

Commit

Permalink
Added ability to filter based on YAML key
Browse files Browse the repository at this point in the history
Closes #35
  • Loading branch information
HEmile committed Apr 17, 2021
1 parent a2b02d3 commit ad89a1e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions juggl/viz/query-builder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {NodeCollection} from 'cytoscape';
import searchQuery, {ISearchParserDictionary} from 'search-query-parser';
import cytoscape from 'cytoscape';
import cytoscape, {NodeSingular} from 'cytoscape';


const _containsSelector = function(attribute: string, filters: string|string[], op='*='): string[] {
Expand Down Expand Up @@ -53,8 +53,14 @@ const literal = function(atomicQuery: ISearchParserDictionary, key: string): str


const _parseAtomicQuery = function(query: string, nodes: NodeCollection): NodeCollection {
const keys:Set<string> = new Set();
nodes.forEach((node:NodeSingular) => {
Object.keys(node.data()).forEach((key) => keys.add(key));
});
const keywords = ['file', 'tag', 'raw', 'match-case', 'ignore-case', 'class'];
keywords.push(...keys);
const options = {
keywords: ['file', 'name', 'content', 'tag', 'path', 'raw', 'match-case', 'ignore-case', 'class'],
keywords: keywords,
tokenize: true,
offsets: false,
};
Expand Down

0 comments on commit ad89a1e

Please sign in to comment.