Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

284
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda