I am new using meteor, and I try to create a simple search function using the easy search package.
In the terminal I do not generate any error and that is what I do not know what I’m doing wrong. I can not make me generate any results of the search.
I hope you can guide me in this problem, this is the code that I am using.
Packages installed
matteodem:easy-search
easy:search
easysearch:components
easysearch:core
client/main.html
<body>
{{> searchBox}}
</body>
<template name="searchBox">
{{> EasySearch.Input index=patientsIndex }}
<ul>
{{#EasySearch.Each index=patientsIndex }}
<li>Name of the patient: {{name}}</li>
{{/EasySearch.Each}}
</ul>
</template>
client/main.js
import { Template } from 'meteor/templating';
import './main.html';
Template.searchBox.helpers({
patientsIndex() {
return PatientsIndex;
}
});
lib/collection.js
Patients = new Mongo.Collection('patients');
PatientsIndex = new EasySearch.Index({
collection: Patients,
fields: ['name'],
engine: new EasySearch.MongoDB()
});