@riboseinc/anafero-cli 0.0.56 → 0.0.57

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/build-site.mjs CHANGED
@@ -317735,26 +317735,14 @@ ${inject.head ?? ""}`;
317735
317735
  };
317736
317736
  }
317737
317737
  this.ref("name");
317738
+ this.field("title", { boost: 2 });
317738
317739
  this.field("body");
317739
317740
  let done12 = 0;
317740
317741
  const total = Object.keys(contentCache).length + Object.keys(resourceDescriptions).length;
317741
317742
  console.debug("Index pipeline functions during", this.pipeline._stack.map((f3) => f3.label));
317742
317743
  console.debug("Index search pipeline functions during", this.searchPipeline._stack.map((f3) => f3.label));
317743
- for (const [uri, content] of Object.entries(contentCache)) {
317744
- done12 += 1;
317745
- indexProgress({ state: `adding entry for ${uri}`, total, done: done12 });
317746
- const label = content?.content?.labelInPlainText?.normalize("NFKD").replace(/\p{Diacritic}/gu, "").trim();
317747
- if (label) {
317748
- const entry = {
317749
- name: uri,
317750
- body: label
317751
- };
317752
- this.add(entry, { boost: 5 });
317753
- } else {
317754
- console.warn("No label for", uri);
317755
- }
317756
- }
317757
- for (const [uri] of Object.entries(resourceDescriptions)) {
317744
+ const searchableResources = { pages: [], resources: [] };
317745
+ for (const [uri, meta] of Object.entries(resourceDescriptions)) {
317758
317746
  done12 += 1;
317759
317747
  indexProgress({ state: "adding entries for subresources", total, done: done12 });
317760
317748
  const rels = reader.resolve(uri);
@@ -317762,15 +317750,28 @@ ${inject.head ?? ""}`;
317762
317750
  ([s2, p3, o2]) => p3 === "hasPart" && (s2 === ROOT_SUBJECT || s2 === uri) && !o2.startsWith("data:") && (!isURIString(o2) || !reader.exists(o2))
317763
317751
  );
317764
317752
  const body = relationsExcludingReferences.map(([, , o2]) => o2).join("").trim().normalize("NFKD").replace(/\p{Diacritic}/gu, "").trim();
317765
- if (body) {
317753
+ const title = meta.labelInPlainText.normalize("NFKD").replace(/\p{Diacritic}/gu, "").trim();
317754
+ if (body || title) {
317766
317755
  const entry = {
317767
317756
  name: uri,
317768
- body
317757
+ body,
317758
+ title,
317759
+ lang: meta.primaryLanguageID ?? ""
317769
317760
  };
317770
- this.add(entry);
317761
+ if (contentCache[uri]) {
317762
+ searchableResources.pages.push(entry);
317763
+ } else {
317764
+ searchableResources.resources.push(entry);
317765
+ }
317771
317766
  } else {
317772
317767
  }
317773
317768
  }
317769
+ for (const entry of searchableResources.pages) {
317770
+ this.add(entry, { boost: 2 });
317771
+ }
317772
+ for (const entry of searchableResources.resources) {
317773
+ this.add(entry);
317774
+ }
317774
317775
  });
317775
317776
  console.debug("Index pipeline functions after", lunrIndex.pipeline._stack.map((f3) => f3.label));
317776
317777
  console.debug("Index search pipeline functions after", lunrIndex.searchPipeline?._stack?.map((f3) => f3.label));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riboseinc/anafero-cli",
3
3
  "type": "module",
4
- "version": "0.0.56",
4
+ "version": "0.0.57",
5
5
  "packageManager": "yarn@4.5.0",
6
6
  "bin": {
7
7
  "build-site": "build-site.mjs"