I need to implement Search and Sort to my app and i’m trying EasySearch.
At a first try using engine: new EasySearch.Minimongo()
enables the Search while the rest of the features continue working (like edit, delete).
But if i want to implement Sorting, the only way is to use the engine: new EasySearch.MongoDB({ })
, which creates an additional collection, and then the edit, delete features stop working, because it’s using that new collection.
How can i implement Search and Sort and still have all the features available? Or please suggest another easy to use Search library or a tutorial.
Here is my code:
Collection:
Cvs = new Mongo.Collection('cvs')
CvsIndex = new EasySearch.Index({
collection: Cvs,
fields: ['name'],
engine: new EasySearch.MongoDB({
sort: () => {createdAt: -1}
})
})
//Methods:
Meteor.methods({
toggleMenuItem: function (id, currentState) {
deleteCv: function (id) {
Cvs.remove(id)
}
})
Client:
{{> EasySearch.Input index=cvsIndex attributes=searchAttributes }}
{{#EasySearch.Each index=cvsIndex }}
{{> Interviu}}
{{/EasySearch.Each}}
Template.Interviuri.helpers({
cvsIndex: () => CvsIndex,