upgrade filter function
continuous-integration/drone/push Build is failing Details

WORK-RHA
Rayhân HASSOU 1 year ago
parent f20a742667
commit ab59eef2d5

@ -100,10 +100,17 @@ export class IngredientsGateway {
const client = await this.connection.getPoolClient()
const query = {
text: 'SELECT * FROM Ingredients WHERE LOWER(name) LIKE $1 ORDER BY name',
values: [`%${prompt.toLowerCase()}%`],
text: `
CREATE EXTENSION IF NOT EXISTS pg_trgm; -- Vérifie si l'extension est déjà installée, sinon l'installe
SELECT *
FROM Ingredients
WHERE LOWER(name) LIKE $1
ORDER BY similarity(name, $2) DESC, name ASC;
`,
values: [`%${prompt.toLowerCase()}%`, prompt.toLowerCase()],
};
const res = await client.query(query);
client.release()

Loading…
Cancel
Save