【问题标题】:EasySearch not working property, but it worked beforeEasySearch 不工作的财产,但它以前工作过
【发布时间】:2015-06-29 02:12:13
【问题描述】:

我使用 Meteor,这是有史以来最好的东西。我现在真的很喜欢 Web 开发,而且 javascript 变得非常有趣。

我目前正在为我的网站实施 EasySearch 解决方案,但由于某种原因它不再工作了,它以前工作过。

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

那段时间,我主要致力于实现 Collectionsfs,更改数据的字段设置。

模板代码:

    <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代码:

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

【问题讨论】:

    标签: javascript mongodb meteor meteorite meteor-helper


    【解决方案1】:

    尝试在您的软件包列表中添加 ma​​tteodem:easy-search@1.5.6。 Easy search 有一个不支持旧结构的新版本。或者,您可以访问此链接以迁移到最新版本。 http://matteodem.github.io/meteor-easy-search/getting-started/

    【讨论】:

      猜你喜欢
      • 2021-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-14
      • 1970-01-01
      相关资源
      最近更新 更多