How to implement full-text search using Sail.js and MySQL?

I do not think Waterline currently supports this feature.

So, what other npm packages do I need to install so that the user can use full-text search in the application?

I want my users to enter keywords in a single input, and then the server will return the filtered data from multiple columns to more than one table specified in the database.

My web application uses Angular.js, Sails.js, and MySQL.

+4
source share
1 answer

Do you mean "MATCH" -Syntax?

Waterline , find(), findOne(),... . , Waterline ( , ), query() - (postgresql/mysql) native() - (mongodb):

Foomodel.query("SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('" + var +"')", function(err,result){
   if(err){
     return console.log(err);
   }else{
     console.log(result);
   }
});

: http://beta.sailsjs.org/#/documentation/reference/Models/Model-Methods/query.html

+1

Source: https://habr.com/ru/post/1545251/


All Articles