JSFiddle - React, Tailwind, and code Playground

by swordys

HTML

<script src="https://rawgit.com/olivernn/lunr.js/v2.0.0-alpha.3/lunr.js" />

JavaScript

var data = [{
    "type": "exhibitors",
    "id": 1,
    "name": "2.M.I."
  },
  {
    "type": "exhibitors",
    "id": 2,
    "name": "2MATECH"
  },
  {
    "type": "exhibitors",
    "id": 3,
    "name": "2MORO SOLUTIONS"
  },
  {
    "type": "exhibitors",
    "id": 4,
    "name": "3D SYSTEMS LAYERWISE"
  },
  {
    "type": "exhibitors",
    "id": 5,
    "name": "3V FASTENERS"
  },
  {
    "type": "exhibitors",
    "id": 6,
    "name": "40 - 30"
  },
  {
    "type": "exhibitors",
    "id": 7,
    "name": "4DCONCEPT"
  },
  {
    "type": "exhibitors",
    "id": 8,
    "name": "A&P INTERNATIONAL SERVICES"
  },
  {
    "type": "exhibitors",
    "id": 9,
    "name": "A&T AEROSPACE"
  },
  {
    "type": "exhibitors",
    "id": 10,
    "name": "A.E. PETSCHE COMPANY"
  },
  {
    "type": "exhibitors",
    "id": 11,
    "name": "A.I.A.D AND MOD ITALY"
  },
  {
    "type": "exhibitors",
    "id": 12,
    "name": "A.S. AVIONICS SERVICES"
  },
  {
    "type": "exhibitors",
    "id": 13,
    "name": "A+ METROLOGIE"
  },
  {
    "type": "exhibitors",
    "id": 14,
    "name": "A2C AIR COST CONTROL"
  },
  {
    "type": "exhibitors",
    "id": 15,
    "name": "AAI - AUSTRIAN AERONAUTICS INDUSTRIES GROUP"
  },
  {
    "type": "exhibitors",
    "id": 16,
    "name": "AAR CORP."
  },
  {
    "type": "exhibitors",
    "id": 17,
    "name": "AAROK"
  },
  {
    "type": "exhibitors",
    "id": 18,
    "name": "AB CORPORATE AVIATION"
  },
  {
    "type": "exhibitors",
    "id": 19,
    "name": "ABA GRINDING TECHNOLOGIES GMBH"
  },
  {
    "type": "exhibitors",
    "id": 20,
    "name": "ACA"
  }
];


lunrIdx = lunr(function() {
  this.ref('id');
  this.field('name');

  this.metadataWhitelist = ['position'];

  data.forEach(function(doc) {
    this.add(doc)
  }, this);
});



console.log(lunrIdx.search('fast*').length);