@riboseinc/anafero-cli 0.0.66 → 0.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bootstrap.js +41 -5
- package/bootstrap.js.map +2 -2
- package/build-site.mjs +64 -11
- package/package.json +1 -1
package/bootstrap.js
CHANGED
|
@@ -72214,12 +72214,48 @@ schema (${ast._tag}): ${ast}`;
|
|
|
72214
72214
|
|
|
72215
72215
|
// ../anafero/search.mts
|
|
72216
72216
|
function preprocessStringForIndexing(text) {
|
|
72217
|
-
return text.normalize("NFKD").replace(/\p{Diacritic}/gu, "").trim();
|
|
72217
|
+
return text.normalize("NFKD").replace(/\p{Diacritic}/gu, "").replace(/[\p{P}$+<=>^`|~]/gu, " ").replace(/[\u200B-\u200D\uFEFF]/g, "").trim();
|
|
72218
72218
|
}
|
|
72219
|
-
function extractRelationsForIndexing(uri, graph,
|
|
72220
|
-
|
|
72221
|
-
|
|
72219
|
+
function extractRelationsForIndexing(uri, graph, isIndexable, isAlreadyIndexed, _seen, _log) {
|
|
72220
|
+
const seen = _seen ?? /* @__PURE__ */ new Set();
|
|
72221
|
+
seen.add(uri);
|
|
72222
|
+
const nonData = graph.filter(
|
|
72223
|
+
([, , o2]) => !o2.startsWith("data:")
|
|
72222
72224
|
);
|
|
72225
|
+
const immediateGraph = nonData.filter(
|
|
72226
|
+
([s, ,]) => s === uri || s === ROOT_SUBJECT
|
|
72227
|
+
);
|
|
72228
|
+
const references = immediateGraph.filter(
|
|
72229
|
+
([, , o2]) => isURIString(o2)
|
|
72230
|
+
);
|
|
72231
|
+
const indexable = immediateGraph.filter(
|
|
72232
|
+
([s, p, o2]) => !isURIString(o2) && isIndexable([s, p, o2])
|
|
72233
|
+
).map(([, , o2]) => o2).filter((o2) => o2.trim() !== "");
|
|
72234
|
+
for (const [, , o2] of references) {
|
|
72235
|
+
if (_log) {
|
|
72236
|
+
console.debug(
|
|
72237
|
+
"search: processing triple object",
|
|
72238
|
+
{ o: o2, isAlreadyIndexed: isAlreadyIndexed(o2) }
|
|
72239
|
+
);
|
|
72240
|
+
}
|
|
72241
|
+
if (!isAlreadyIndexed(o2) && !seen.has(o2)) {
|
|
72242
|
+
indexable.push(...extractRelationsForIndexing(
|
|
72243
|
+
o2,
|
|
72244
|
+
graph,
|
|
72245
|
+
isIndexable,
|
|
72246
|
+
isAlreadyIndexed,
|
|
72247
|
+
seen,
|
|
72248
|
+
_log
|
|
72249
|
+
));
|
|
72250
|
+
}
|
|
72251
|
+
}
|
|
72252
|
+
if (_log) {
|
|
72253
|
+
console.debug(
|
|
72254
|
+
"search: obtained indexable from graph",
|
|
72255
|
+
{ uri, graph, indexable }
|
|
72256
|
+
);
|
|
72257
|
+
}
|
|
72258
|
+
return indexable;
|
|
72223
72259
|
}
|
|
72224
72260
|
var init_search = __esm({
|
|
72225
72261
|
"../anafero/search.mts"() {
|
|
@@ -109636,7 +109672,7 @@ schema (${ast._tag}): ${ast}`;
|
|
|
109636
109672
|
const debouncedQueryTrimmed = debouncedQuery.trim();
|
|
109637
109673
|
if (index && debouncedQueryTrimmed !== "") {
|
|
109638
109674
|
const normalizedQuery = preprocessStringForIndexing(
|
|
109639
|
-
debouncedQuery.replace(
|
|
109675
|
+
debouncedQuery.replace(/\*/g, " ")
|
|
109640
109676
|
);
|
|
109641
109677
|
const tokens = import_lunr.default.tokenizer(normalizedQuery);
|
|
109642
109678
|
console.debug("Search: tokens", tokens);
|