0.1.2 • Published 4 years ago

@smarterlabs/norman-plugin-lunr v0.1.2

Weekly downloads
17
License
MIT
Repository
github
Last release
4 years ago

@smarterlabs/norman-plugin-lunr

Creates lunr indexes with Norman.

Installation

npm install --save @smarterlabs/norman-plugin-lunr

or with Yarn

yarn add @smarterlabs/norman-plugin-lunr

Usage

const Norman = require(`@smarterlabs/norman`)
const lunrPlugin = require(`@smarterlabs/norman-source-shopify`)

const norman = new Norman({
   collections: {
      'lunr-index': {
         type: `lunr`,
         ref: `id`,
         fields: [`title`, `sku`]
      },
   },
   on: {
      'data:shopify:product': ({ add, data }) => {
         add(`lunr-index`, data)
      },
   },
   plugins: [
      lunrPlugin(),
   ],
})