matteodem / meteor-easy-search

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

IndexMissingException[[videoSearch] missing]] error #40

Closed sasikanth513 closed 10 years ago

sasikanth513 commented 10 years ago

I've created a search index in common code

Videos = new Mongo.Collection("myvideos");
EasySearch.createSearchIndex('videoSearch', {
  'collection'    : Videos,              // instanceof Meteor.Collection
  'field'         : ['title', 'tags'],    // can also be an array of fields
  'limit'         : 20,                   // default: 10
  'use'           :"elastic-search"
});

and in the client side template helper I'm calling this index by

EasySearch.search('videoSearch',"mkbhd", function (err, data) {
            console.log(err);
            console.log(data);
        });

I've started the elastic search service and in the server side(terminal) I'm getting the following error

Had an error while searching!
 { [Error: IndexMissingException[[videoSearch] missing]] message: 'IndexMissingException[[videoSearch] missing]' }

what is the issue with this, anyone has idea?

sasikanth513 commented 10 years ago

Moved the search to server side, working fine now

var res=EasySearch.search('videoSearch',query,{});
matteodem commented 10 years ago

Just as a little reminder, it's important that you call createSearchIndex on both the server and the client, so that you can also use the blaze components / Javascript API on the client.

sasikanth513 commented 10 years ago

As said in my question, I've created searchIndex in commoncode

app\lib\collection.js

Anyway, Thanks for the suggestion

matteodem commented 10 years ago

Oh, did not interpret that correctly then. Does your code still not work on the client?