feat(search): recherche intelligente — parsing backend + pg_trgm fuzzy

- parseSearchTokens() côté backend : extrait type (async/openapi),
  version (v1, 1.2.3) et latestOnly depuis la chaîne brute
- Recherche fuzzy via word_similarity (pg_trgm, seuil 0.5) + ILIKE
- latestOnly automatique quand champ non vide sans version explicite
- Suppression de parseSearch() dans BrowseComponent et CatalogComponent
- Suppression de version/latestOnly de ApiListQuery (géré par le backend)
- Activation de pg_trgm via CREATE EXTENSION dans SeederService
- Tests unitaires Vitest pour parseSearchTokens (24 cas)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
z3n
2026-06-17 08:57:45 +00:00
parent e1a3dbc85b
commit 498c6577e4
6 changed files with 262 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
import { Injectable, OnApplicationBootstrap } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Repository, DataSource } from 'typeorm';
import * as fs from 'fs/promises';
import { ApiEntryEntity } from '../apis/api-entry.entity';
import { CategoryEntity } from '../categories/category.entity';
@@ -593,9 +593,13 @@ export class SeederService implements OnApplicationBootstrap {
@InjectRepository(CategoryEntity)
private readonly categoryRepo: Repository<CategoryEntity>,
private readonly docsService: DocsGenerationService,
private readonly dataSource: DataSource,
) {}
async onApplicationBootstrap(): Promise<void> {
// Activer l'extension pg_trgm pour la recherche fuzzy
await this.dataSource.query('CREATE EXTENSION IF NOT EXISTS pg_trgm');
const forceReseed = process.env.FORCE_RESEED === 'true';
if (forceReseed) {
await this.reset();