diff --git a/packages/web/src/lib/search/Search.ts b/packages/web/src/lib/search/Search.ts index 176849dd..d0f72023 100644 --- a/packages/web/src/lib/search/Search.ts +++ b/packages/web/src/lib/search/Search.ts @@ -67,8 +67,11 @@ export class Search { adrs.map((adr) => [ adr.slug, { - title: adr.title || "Untitled", - verbatim: adr.body.enhancedMdx // TODO: remove tags (https://github.com/thomvaill/log4brains/issues/5) + title: adr.title || "Untitled", + body: adr.body.enhancedMdx, // TODO: remove tags (https://github.com/thomvaill/log4brains/issues/5) + status: adr.status || 'draft', + tags: (adr.tags || []).join(" "), + deciders: adr.lastEditAuthor + " " + (adr.deciders || []).join(" ") } ]) ); @@ -76,16 +79,21 @@ export class Search { const index = lunr((builder) => { builder.ref("slug"); builder.field("title", { boost: 1000 }); - builder.field("verbatim"); + builder.field("tags", {boost: 50 }); + builder.field("status", {boost: 50 }); + builder.field("body"); + builder.field("deciders"); // eslint-disable-next-line no-param-reassign builder.metadataWhitelist = ["position"]; - adrsForSearch.forEach((adr, slug) => { - builder.add({ - slug, - title: adr.title, - verbatim: adr.verbatim - }); + builder.add({ + slug, + title: adr.title, + body: adr.body, + status: adr.status, + deciders: adr.deciders, + tags: adr.tags + }); }); }); return new Search(index, adrsForSearch);