in web/js/find.js [97:136]
await focusOn(graph, node.labels[0], "name", node.properties.name)
return
}
} else {
node.selected = false
}
}
}
// Set up the debounce function so we don't search repeatedly as the user types
const debounceHighlight = debounce((g, n) => { highlightNode(g, n) })
/**
* Handle text being entered in the search bar.
*
* @param {*} graph
* @param {*} key
* @param {*} txt
*/
export default async function find(graph, keyPressed, txt) {
// Reload the entire graph if the field is empty
if (keyPressed === "Enter" && txt === "") {
await focusOn(graph, null, null, null, false)
return
}
// Break the text down into search terms
//
// Assume a term is searching by name
//
// "Eric" means search for a node with name=Eric
// "title:PSA" means search for all nodes with title=PSA
const terms = []
const tokens = txt.split("and")
for (const token of tokens) {
const term = {}
if (token.indexOf(":") > -1) {
const keyval = token.split(":")
if (keyval[0] === "label") {