diff --git a/packages/cms/README.md b/packages/cms/README.md index 34aba7fe7..ad51151ed 100644 --- a/packages/cms/README.md +++ b/packages/cms/README.md @@ -309,6 +309,7 @@ A Canon site often takes the form of DataCountry.io, and is made of **Profiles** | `CANON_CMS_REQUESTS_PER_SECOND` | Sets the `requestsPerSecond` value in the [promise-throttle](https://www.npmjs.com/package/promise-throttle) library, used for rate-limiting Generator requests | 20 | | `CANON_CMS_GENERATOR_TIMEOUT` | The number of ms after which a generator request times out, defaults to 5s. Increase this if you are making heavy requests that exceed 5s | 5000 | | `CANON_CMS_DEEPSEARCH_API` | Server location of Deepsearch API | `undefined` | +| `CANON_CMS_LUNR` | Enable Basic LUNR search | `undefined` | | `CANON_CMS_HTACCESS_USER` | Authentication user for PDF generation on .htaccess protected pages | `undefined` | | `CANON_CMS_HTACCESS_PW` | Authentication password for PDF generation on .htaccess protected pages | `undefined` | | `CANON_CMS_PDF_DISABLE` | Disable the PDF generation endpoint | `undefined` | diff --git a/packages/cms/src/cache/searchIndexByLocale.js b/packages/cms/src/cache/searchIndexByLocale.js index 0a357711d..7c1818252 100644 --- a/packages/cms/src/cache/searchIndexByLocale.js +++ b/packages/cms/src/cache/searchIndexByLocale.js @@ -40,13 +40,15 @@ module.exports = async function(app) { results.forEach(result => { const content = result.content.find(d => d.locale === locale); - const payload = content ? { - id: content.id, - name: content.name, - keywords: content.keywords, - attr: content.attr - } : {}; - this.add(payload, {boost: result.zvalue}); + if (content) { + const payload = { + id: content.id, + name: content.name, + keywords: content.keywords, + attr: content.attr + }; + this.add(payload, {boost: result.zvalue}); + } }, this); }); }