FS Collection + meteor-easy-search


#1

I can’t figure out how to use meteor-easy-search over an FS collection. Any help on this would be greatly appreciated? I have a Todos collection that works fine if I just replace uploads to todos. Just can’t figure out how to get this working with a FS Collection. I’m a intermediate noob here.

collections/uploads.js

Uploads = new FS.Collection('uploads',
{stores:[new FS.Store.FileSystem('uploads',{path:'~/uploads'})]
});
Uploads.allow({
  insert:function(){
    return true;
  },
  update:function(){
    return true;
  },
  remove:function(){
    return true;
  },
  download:function(){
    return true;
  }
})

_header.js

Uploads.initEasySearch(['name'], {
    'limit' : 4
});

_header.html

<template name="_header">
    <div class="navbar-fixed">
  <nav>
    <div class="nav-wrapper indigo darken-4">
      <form>
        <div class="input-field">
          {{> esInput index="uploads" type="search" class="input-field" placeholder="Search..." }}
          <label for="search"><i class="material-icons">search</i></label>
          <i class="material-icons">close</i>
        </div>
      </form>

    </div>
    {{> searchResults}}
  </nav>

</div>

</template>

searchResults.html

<template name="searchResults">
  <div class="row">
    <div class="col s12">
      {{#ifEsIsSearching index="uploads" logic="OR" }}
        <div>Searching...</div>


    {{#ifEsHasNoResults index="uploads" logic="OR" }}
           <div class="no-results">No results found!</div>
       {{/ifEsHasNoResults}}
           {{/ifEsIsSearching}}
        <ul class="tabs">
           {{#esEach index="uploads"}}
           <li class="tab col s3"><a class="active indigo-text truncate" href="{{name}}">{{name}}</a></li>
           {{else}}
           something else
          {{/esEach}}
        </ul>


    </div>
  </div>
 </template>