in web/js/focus-on.js [43:99]
export async function focusOnMultiple(graph, terms) {
const results = []
// Do separate queries to Neptune for each term and combine them
for (const term of terms) {
if (!term.label && !term.key && !term.value) {
console.error("term must have label or key, value, and label")
continue
}
let searchResult
try {
const options = {}
if (focus) {
options.focus = {
label: term.label,
key: term.key,
value: term.value,
}
}
searchResult = await post("search-post", options, graph.partition)
results.push(searchResult)
} catch (ex) {
console.error(ex)
searchResult = {}
}
}
const combined = {
nodes: [],
edges: [],
}
const nodeIds = {}
const edgeIds = {}
for (const searchResult of results) {
for (const node of searchResult.nodes) {
if (node.id in nodeIds) continue
nodeIds[node.id] = true
combined.nodes.push(node)
}
for (const edge of searchResult.edges) {
if (edge.id in edgeIds) continue
edgeIds[edge.id] = true
combined.edges.push(edge)
}
}
graph.data = combined
graph.offset = {
x: 0,
y: 0,
}
render(graph, true)
}