Im using Easy-Search package and would like to search posts (or comments to those posts).
The problem: Nothing gets shown when search is typed in. No error messages shown on both console.log and server.
Updates: I did console.log on both the publish and subscribe. So the subscribe returns the console.log on the browser devtools but the publish does not return anything on the server terminal.
Template html
<template name="searchPosts">
{{> esInput id="main" index=indexes placeholder="Search.." }}
{{#esEach index="posts"}}
{{> postItem}}
{{/esEach}}
{{#esEach index="comments"}}
{{> postItem}}
{{/esEach}}
</template>
Template js - client
Template.searchPosts.onCreated(function () {
var self = this, instance;
instance = EasySearch.getComponentInstance(
{ id: 'main', index: 'posts'},
{ id: 'main', index: 'comments'}
);
instance.on('searchingDone', function (searchingIsDone) {
searchingIsDone && console.log('I am done!');
});
instance.on('currentValue', function (val) {
console.log('The user searches for ' + val);
});
this.subscribe("allDocs");
});
Template.searchPosts.helpers({
indexes : function () {
return ['posts', 'comments'];
},
posts: function () {
return Posts.find();
}
});