Tom chan
Tom chan

Reputation: 365

EasySearch not working property, but it worked before

I use Meteor and it is the best thing ever. I really enjoy web development now and javascript become so much fun.

I am currently implementing the EasySearch solution for my site and for some reason it s not working anymore, it worked before.

https://github.com/matteodem/meteor-easy-search

During those time, I works mainly on implementing Collectionsfs, changed the field setting for data.

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 code:

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
    });
...........

Upvotes: 0

Views: 291

Answers (1)

Lance Mathew
Lance Mathew

Reputation: 176

Try adding matteodem:[email protected] in your package list. Easy search has a new version that doesn't support the old structure. OR you can visit this link for migrating to the latest version. http://matteodem.github.io/meteor-easy-search/getting-started/

Upvotes: 0

Related Questions