MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / searchWiki

Function searchWiki

deployments/desktop/static/desktop.js:4157–4176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4155 }
4156
4157 async function searchWiki() {
4158 const rawQuery = $("wikiQuery").value.trim();
4159 if (!rawQuery) {
4160 await loadWiki();
4161 return;
4162 }
4163 const data = await api(`/api/wiki/search?user_id=${encodeURIComponent(currentUser())}&q=${encodeURIComponent(rawQuery)}&limit=20`);
4164 const nodes = data.nodes || [];
4165 state.wikiNodes = nodes;
4166 try {
4167 const graph = await api(`/api/wiki/graph?user_id=${encodeURIComponent(currentUser())}&q=${encodeURIComponent(rawQuery)}&limit=120`);
4168 if (graph.nodes?.length) state.wikiGraph = graph;
4169 } catch (error) {
4170 console.warn("Wiki search graph unavailable.", error);
4171 }
4172 renderWikiResultNodes(nodes, ui().wiki.resultsCount(nodes.length));
4173 if (nodes[0]) setWikiEntry(rawGraphTitle(nodes[0]), rawGraphBody(nodes[0]), nodes[0].node_id || graphId(nodes[0]), { renderRelations: false });
4174 if (state.wikiView === "graph") renderWikiGraph();
4175 if (state.wikiView === "list") renderWikiList();
4176 }
4177
4178 function normalizeCitationSource(source, index = 0) {
4179 const metadata = source?.metadata || {};

Callers 1

openCitationSourceFunction · 0.70

Calls 12

loadWikiFunction · 0.85
currentUserFunction · 0.85
renderWikiResultNodesFunction · 0.85
uiFunction · 0.85
setWikiEntryFunction · 0.85
rawGraphTitleFunction · 0.85
rawGraphBodyFunction · 0.85
graphIdFunction · 0.85
renderWikiGraphFunction · 0.85
renderWikiListFunction · 0.85
$Function · 0.70
apiFunction · 0.70

Tested by

no test coverage detected