re: How to create small search engine for your awesome project? VIEW POST

VIEW FULL DISCUSSION
 

Great article! Remember to add error first management in search function:

function search(search_string, func) {
     pool.query(
        "SELECT * FROM university WHERE fts @@ to_tsquery('english',$1)", 
        [search_string],
        function(err, result) {  
            if(err) {
                func(err)
            } else {
                func(null, result.rows)
            }
        }
    );
}

And then, when you call the function:

search(req.query.text, function(error, data_items) {...}
 
 

Thank you for your awesome article. I have worked with dedicated full text search database called Apache Solr. Thanks to you I know that I can use that feature in a relational DB.

code of conduct - report abuse