How can I search in a big data collection on server side without publishing everything in meteor


#1

Hey all! I’m a newbie to Meteor. I need to build up a text search system with typeahead-like feature using Meteor js. My collection on the server side has about 1 million words, so it’s impossible to publish them all (my page will take forever to load so I’m assuming the collection is so large that the sync takes forever). However, each time, my system needs to search within the whole collection. Anyone has suggestions about how to do this? Thanks a lot


#2

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

You can get the functionality you want, plus it gives you options on data fetching sources: mongo-db, minimongo and others.

Hope that helps.


#3

Male a server method which return the result of the query


#4

Hey! Do you mean there’s no need to publish the collection but use Meteor.method to return the search result?


#5

exactly. You can search within the method and then return an object with the data.


#6

Gotcha. And it works! Thanks a lot