MCPcopy
hub / github.com/Snailclimb/JavaGuide / recordFor

Function recordFor

scripts/docsearch-index.mjs:101–123  ·  view source on GitHub ↗
({ url, title, hierarchy, content, anchor, type, position })

Source from the content-addressed store, hash-verified

99}
100
101function recordFor({ url, title, hierarchy, content, anchor, type, position }) {
102 const recordUrl = anchor ? `${url}#${anchor}` : url;
103
104 return {
105 objectID: `${slug(url)}-${anchor || "page"}-${position}`,
106 hierarchy,
107 content,
108 anchor,
109 url: recordUrl,
110 url_without_anchor: url,
111 type,
112 lang: "zh-CN",
113 language: "zh-CN",
114 version: "current",
115 tags: ["javaguide"],
116 weight: {
117 pageRank: 0,
118 level: type === "content" ? 0 : Number(type.replace("lvl", "")) || 0,
119 position,
120 },
121 title,
122 };
123}
124
125function extractRecords(url, html) {
126 const $ = load(html);

Callers 1

extractRecordsFunction · 0.85

Calls 1

slugFunction · 0.85

Tested by

no test coverage detected