Using Meteor has completely transformed my web development experience. Javascript has become incredibly fun for me.
I recently integrated the EasySearch solution on my site, but unfortunately it seems to have stopped working. It was functioning perfectly before.
Click here to visit the EasySearch repository on Github
During this time, I mainly focused on implementing Collectionsfs and made some changes to the field settings for data.
Snippet of Template code:
<div class="container">
{{> esInput index="posts" id="search" placeholder="Search Listing..." convertnumber=true }}
</div>
{{#ifEsIsSearching index="posts" id="search" logic="OR" }}
<div>Searching...</div>
{{/ifEsIsSearching}}
{{#ifEsInputIsEmpty index="posts" id="search"}}
<div class="posts">
{{#each posts}}
{{> postItem}}
{{/each}}
</div>
{{else}}
<div class="posts">
{{#esEach index="posts" id="search"}}
{{> postItem}}
{{/esEach}}
</div>
{{/ifEsInputIsEmpty}}
{{#ifEsHasNoResults index="posts" id="search" logic="OR" }}
<div class="no-results">No results found!</div>
{{/ifEsHasNoResults}}
</template>
Mongodb snippet:
Posts = new Mongo.Collection('posts');
Posts.initEasySearch(['firstName', 'lastName', 'university'], {
'limit' : 20,
'use' : 'mongo-db'
});
Posts.allow({
update: function(userId, post) { return ownsDocument(userId, post); },
remove: function(userId, post) { return ownsDocument(userId, post); },
});
Meteor.methods({
postInsert2: function(postAttributes) {
check(Meteor.userId(), String);
check(postAttributes, {
firstName: String,
lastName: String,
address: String,
phone: String,
university: String,
loanPeriod: String,
loanRate: String,
loanAmount: String,
job: String
});
...........