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

241
Visualizações
How to search for data in many tables?

How to search data in all tables from my database? I need to create some sort of search like is on Github where after entering the phrase into the search engine, it looks for us both repositories, issues and users, I need to do something like this but with searching in entities like: User, Order and Projects,

I'm using TypeORM and simple search query looks like below:

const data = await this.conn
      .getRepository(Order)
      .createQueryBuilder('order')
      .where('order.name = :name ', { name : name })
      .leftJoin('order.author', 'author')
      .orderBy('order.lastUpdate', 'DESC');

but how to search not only in Order entity but also in other tables like User and Projects? How the biggest company search engine works?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Big companies such as google base their technologies on AI now, using them as a system to organise Big Data (see more on that here). However, google originally used the Page Rank algorithm that would assign higher values to websites that had high referral rates from other sites (see here).

It sounds like what you would get the most from is the LIKE keyword (see the basics) in combination with the UNION keyword (info here).

You could probably get some good results with something like this in SQL (I dont know TypeORM):

SELECT * FROM table1 WHERE name LIKE '%searchterm%'
UNION
SELECT * FROM table2 WHERE name LIKE '%searchterm%';
over 4 years ago · Santiago Trujillo Relatório
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