matteodem / meteor-easy-search

Easy-to-use search for Meteor with Blaze Components
MIT License
438 stars 68 forks source link

Error: [no-index] #614

Closed consciousweb closed 7 years ago

consciousweb commented 7 years ago

Error

Exception from Tracker recompute function:
meteor.js:930 Error: Please provide an index for your component [no-index]
meteor.js:930 Error
    at InputComponent.initializeBase (easysearch_components.js:113)
    at InputComponent.<anonymous> (easysearch_components.js:94)
    at blaze.js:1934
    at Function.Template._withTemplateInstanceFunc (blaze.js:3744)
    at blaze.js:1932
    at Object.Blaze._withCurrentView (blaze.js:2271)
    at viewAutorun (blaze.js:1931)
    at Tracker.Computation._compute (tracker.js:339)
    at new Tracker.Computation (tracker.js:229)
    at Object.Tracker.autorun (tracker.js:613)

Indexes.coffee (at root level)

import { Index, MinimongoEngine } from 'meteor/easy:search'

PostsIndex = new Index(
collection: Posts
fields: [ 'title' ]
engine: new MinimongoEngine)

Search.js at specific view level

Template.searchBox.helpers({ postsIndex: () => PostsIndex, });

dashboard.html at specific view level

<template name="searchBox">
  {{> EasySearch.Input index=PostsIndex}}

  <ul>
    {{#EasySearch.Each index=PostsIndex}}
      <li>Name of the player: {{title}}</li>
    {{/EasySearch.Each}}
  </ul>

  {{> EasySearch.LoadMore index=PostsIndex}}

  {{#EasySearch.IfNoResults index=PostsIndex}}
    <div class="no-results">No results found!</div>
  {{/EasySearch.IfNoResults}}
</template>

Posts.coffee in collections

@Posts = new Meteor.Collection('posts');

matteodem commented 7 years ago

You have a the wrong case in your html template: PostsIndex should be postsIndex

consciousweb commented 7 years ago

Hi, thanks for the response. I have tried this, and it returns the following:

Exception in template helper: ReferenceError: PostsIndex is not defined
    at Object.postsIndex (http://localhost:3000/app/app.js?hash=be3c0f368c2842a0ee060d3cf43705ed370c370f:629:12)
    at http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=ff99f92f229eaf491d6bb47b2149751f78733c5e:1345:21
    at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1715:16
    at http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=ff99f92f229eaf491d6bb47b2149751f78733c5e:1366:66
    at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12)
    at http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=ff99f92f229eaf491d6bb47b2149751f78733c5e:1365:27
    at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:172:18)
    at http://localhost:3000/app/app.js?hash=be3c0f368c2842a0ee060d3cf43705ed370c370f:401:24
    at wrappedArgFunc (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2960:14)
    at Blaze.View.<anonymous> (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2673:26)
meteor.js:930 Exception from Tracker recompute function:
meteor.js:930 Error: Please provide an index for your component [no-index]
meteor.js:930 Error
    at InputComponent.initializeBase (easysearch_components.js:113)
    at InputComponent.<anonymous> (easysearch_components.js:94)
    at blaze.js:1934
    at Function.Template._withTemplateInstanceFunc (blaze.js:3744)
    at blaze.js:1932
    at Object.Blaze._withCurrentView (blaze.js:2271)
    at viewAutorun (blaze.js:1931)
    at Tracker.Computation._compute (tracker.js:339)
    at new Tracker.Computation (tracker.js:229)
    at Object.Tracker.autorun (tracker.js:613)
js?v=3.exp&libraries=places&callback=GoogleMaps.initialize:136 Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
DB.j @ maps.googleapis.com/maps-api-v3/api/js/29/5/util.js:220
(anonymous) @ js?v=3.exp&libraries=places&callback=GoogleMaps.initialize:136
(anonymous) @ js?v=3.exp&libraries=places&callback=GoogleMaps.initialize:56
(anonymous) @ js?v=3.exp&libraries=places&callback=GoogleMaps.initialize:53
(anonymous) @ js?v=3.exp&libraries=places&callback=GoogleMaps.initialize:56
(anonymous) @ js?v=3.exp&libraries=places&callback=GoogleMaps.initialize:107
(anonymous) @ js?v=3.exp&libraries=places&callback=GoogleMaps.initialize:53
(anonymous) @ js?v=3.exp&libraries=places&callback=GoogleMaps.initialize:107
Sc @ js?v=3.exp&libraries=places&callback=GoogleMaps.initialize:55
Rc.ib @ js?v=3.exp&libraries=places&callback=GoogleMaps.initialize:107
(anonymous) @ stats.js:1
matteodem commented 7 years ago

Please provide reproduction repository if you think this is a bug. To me it seems like it's a Javascript usage error and not an error related to this library.