Simple search function in meteor using EasySearch package


down vote
Good Day,

I’m trying to create a simple search function using the easy search package.

In a nutshell I have done the following-

Defined a schema and index on the client as such:

const Patients = new Mongo.Collection('patients');

const PatientsIndex = new EasySearch.Index({
    collection: Patients,
    fields: ['name'],
    engine: new EasySearch.MongoDB()

I’ve entered the following values into the database:

meteor:PRIMARY> db.patients.find()
{ "_id" : ObjectId("57d6a9f71bad26ba07748f9d"), "name" : "Paul" }

Created a template helper on the client side:

  patientsIndex: () => PatientsIndex

And lastly I’ve created a template which should output the results:

<template name="searchBox">
    {{> EasySearch.Input index=patientsIndex }}
        {{#EasySearch.Each index=patientsIndex }}
            <li>Name of the patient: {{name}}</li>

Now for some reason this just wont work, it renders nothing to the template, I’ very new to this and would really appreciate some assistance.

Thanking you.