How to use the lunr.multiLanguage function in lunr

To help you get started, we’ve selected a few lunr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rjgtav / tos-database / tos-search / src / index.js View on Github external
var idx = lunr(function () {
    if (REGION === REGION_jTOS)
        this.use(lunr.multiLanguage('en', 'jp'));
    if (REGION === REGION_kTOS || REGION === REGION_kTEST)
        this.use(lunr.multiLanguage('en', 'kr'));
    if (REGION === REGION_twTOS)
        this.use(lunr.multiLanguage('en', 'ch'));

    // Disable stemmer
    this.pipeline.remove(lunr.stemmer);

    this.ref('$ID_lunr');
    this.field('$ID');
    this.field('$ID_NAME');
    this.field('Name');
    //this.field('Description');

    Object.entries(documents)
        .forEach(value => {
            let documents = value[1];
            let dataset = value[0];

            documents.forEach((doc) => {
github rjgtav / tos-database / tos-search / src / index.js View on Github external
var idx = lunr(function () {
    if (REGION === REGION_jTOS)
        this.use(lunr.multiLanguage('en', 'jp'));
    if (REGION === REGION_kTOS || REGION === REGION_kTEST)
        this.use(lunr.multiLanguage('en', 'kr'));
    if (REGION === REGION_twTOS)
        this.use(lunr.multiLanguage('en', 'ch'));

    // Disable stemmer
    this.pipeline.remove(lunr.stemmer);

    this.ref('$ID_lunr');
    this.field('$ID');
    this.field('$ID_NAME');
    this.field('Name');
    //this.field('Description');

    Object.entries(documents)
        .forEach(value => {
github rjgtav / tos-database / tos-search / src / index.js View on Github external
var idx = lunr(function () {
    if (REGION === REGION_jTOS)
        this.use(lunr.multiLanguage('en', 'jp'));
    if (REGION === REGION_kTOS || REGION === REGION_kTEST)
        this.use(lunr.multiLanguage('en', 'kr'));
    if (REGION === REGION_twTOS)
        this.use(lunr.multiLanguage('en', 'ch'));

    // Disable stemmer
    this.pipeline.remove(lunr.stemmer);

    this.ref('$ID_lunr');
    this.field('$ID');
    this.field('$ID_NAME');
    this.field('Name');
    //this.field('Description');

    Object.entries(documents)
        .forEach(value => {
            let documents = value[1];
            let dataset = value[0];
github humanseelabs / gatsby-plugin-lunr / gatsby-node.js View on Github external
const index = lunr(function () {
    if (languages.length === 1) {
      this.use(lunr[languages[0]]);
    } else if (languages.length > 1) {
      this.use(lunr.multiLanguage(...languages));
    }

    this.ref('id');
    fields.forEach(({
      name,
      attributes = {}
    }) => {
      this.field(name, attributes);
    });
    getNodes().filter(filterNodes).forEach(n => {
      const fieldResolvers = resolvers[n.internal.type];

      if (fieldResolvers) {
        const doc = _objectSpread({
          id: n.id
        }, Object.keys(fieldResolvers).reduce((prev, key) => _objectSpread({}, prev, {