Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

278
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda