samedi 28 février 2015

Best way to perform a full text search in MongoDB and Mongoose

I'm searching on Google since days and I tried many things but I still can not perform a good full text search on my user collection.


I tried ElasticSearch but was pretty impossible to query and paginate...


I tried many plugins for Mongoose like ElMongo, mongoose-full-text, Mongoosastic, etc... everyone are really bad documented and I don't know how to perform a good full text search.


So, my collection is a normal collection:



user = {
name: String,
email: String,
profile: {
something: String,
somethingElse: String
}
}


I have a search input in a page with a simple POST, if I type hello world what I need is to search on the entire collection fields the matching words of my search query and get the results.


It will be really nice also to have options to handle a pagination like 10 items per page or something...


What is the best solution to achieve this? I'm using MongoDB 2.6.* with Mongoose, NodeJS and ExpressJS.


Thanks.


Aucun commentaire:

Enregistrer un commentaire