Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

276
Views
Search-Engine with MySQL NodeJS

I'm trying to build my own search engine with MySQL. It gets a text like "Stackoverflow+MySQL+SearchEngine", splits it into array [Stackoverflow,MySQL,SearchEngine] and feeds to MySQL like in the following:

var text = filter.split("+");

var sql_statement = ' (title LIKE "%'+text[0]+'%" OR detail1 LIKE "%'+text[0]+'%") ';
for(var i = 1; i < text.length; i++){
                sql_statement += ' AND (title LIKE "%'+text[i]+'%" OR detail1 LIKE "%'+text[i]+'%") ';
}

pool.query('SELECT thread_id,username,date,price,title FROM threads_mphp WHERE'+sql_statement+'ORDER BY thread_id DESC LIMIT ?, ?',[startLimit,amount], function(error,results,fields){});

The database checks if those words exist in either "title" or "detail1". The problem is, it only works only upto 3 words with independant order. If I use more words and random order it won't find the result in the Database. Am I doing something wrong?

Example: Database item Title:"First question in Biology". Strings that will find this item: "bio" ,"biology question","first question in bio", "bio first". Strings that wont find this item: "Biology in question first","biology question first"

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!