chore: consolidate CI, E2E, backend and frontend updates
- CI: workflows updates (cd, ci), remove playwright.yml
- E2E: global-setup, auth/playlists/profile specs
- Remove playwright-report and test-results artifacts from tracking
- Backend: auth, handlers, services, workers, migrations
- Frontend: components, features, vite config
- Add e2e-results.json to gitignore
- Docs: REMEDIATION_PROGRESS, audit archive
- Rust: chat-server, stream-server updates
2026-02-17 15:43:21 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
import (
|
2026-03-09 09:13:18 +00:00
|
|
|
"context"
|
|
|
|
|
"os"
|
|
|
|
|
|
chore: consolidate CI, E2E, backend and frontend updates
- CI: workflows updates (cd, ci), remove playwright.yml
- E2E: global-setup, auth/playlists/profile specs
- Remove playwright-report and test-results artifacts from tracking
- Backend: auth, handlers, services, workers, migrations
- Frontend: components, features, vite config
- Add e2e-results.json to gitignore
- Docs: REMEDIATION_PROGRESS, audit archive
- Rust: chat-server, stream-server updates
2026-02-17 15:43:21 +00:00
|
|
|
"github.com/gin-gonic/gin"
|
2026-03-09 09:13:18 +00:00
|
|
|
"go.uber.org/zap"
|
chore: consolidate CI, E2E, backend and frontend updates
- CI: workflows updates (cd, ci), remove playwright.yml
- E2E: global-setup, auth/playlists/profile specs
- Remove playwright-report and test-results artifacts from tracking
- Backend: auth, handlers, services, workers, migrations
- Frontend: components, features, vite config
- Add e2e-results.json to gitignore
- Docs: REMEDIATION_PROGRESS, audit archive
- Rust: chat-server, stream-server updates
2026-02-17 15:43:21 +00:00
|
|
|
|
|
|
|
|
"veza-backend-api/internal/handlers"
|
|
|
|
|
"veza-backend-api/internal/services"
|
2026-03-09 09:13:18 +00:00
|
|
|
|
|
|
|
|
elasticsearch "veza-backend-api/internal/elasticsearch"
|
chore: consolidate CI, E2E, backend and frontend updates
- CI: workflows updates (cd, ci), remove playwright.yml
- E2E: global-setup, auth/playlists/profile specs
- Remove playwright-report and test-results artifacts from tracking
- Backend: auth, handlers, services, workers, migrations
- Frontend: components, features, vite config
- Add e2e-results.json to gitignore
- Docs: REMEDIATION_PROGRESS, audit archive
- Rust: chat-server, stream-server updates
2026-02-17 15:43:21 +00:00
|
|
|
)
|
|
|
|
|
|
2026-03-09 09:13:18 +00:00
|
|
|
// setupSearchRoutes configure la route de recherche unifiée GET /search et autocomplete (v0.10.2 F363-F365)
|
|
|
|
|
// Uses Elasticsearch when ELASTICSEARCH_URL is set, else falls back to PostgreSQL
|
chore: consolidate CI, E2E, backend and frontend updates
- CI: workflows updates (cd, ci), remove playwright.yml
- E2E: global-setup, auth/playlists/profile specs
- Remove playwright-report and test-results artifacts from tracking
- Backend: auth, handlers, services, workers, migrations
- Frontend: components, features, vite config
- Add e2e-results.json to gitignore
- Docs: REMEDIATION_PROGRESS, audit archive
- Rust: chat-server, stream-server updates
2026-02-17 15:43:21 +00:00
|
|
|
func (r *APIRouter) setupSearchRoutes(router *gin.RouterGroup) {
|
2026-03-09 09:13:18 +00:00
|
|
|
esCfg := elasticsearch.LoadConfig()
|
|
|
|
|
var searchSvc handlers.SearchServiceInterface
|
|
|
|
|
if esCfg.Enabled {
|
|
|
|
|
esClient, err := elasticsearch.NewClient(esCfg, r.logger)
|
|
|
|
|
if err != nil {
|
|
|
|
|
r.logger.Warn("Elasticsearch unavailable, falling back to PostgreSQL search", zap.Error(err))
|
|
|
|
|
searchSvc = services.NewSearchService(r.db, r.logger)
|
|
|
|
|
} else {
|
|
|
|
|
// Optional: run reindex at startup if ELASTICSEARCH_AUTO_INDEX
|
|
|
|
|
if os.Getenv("ELASTICSEARCH_AUTO_INDEX") == "true" {
|
|
|
|
|
idx := elasticsearch.NewIndexer(esClient, r.db.GormDB, r.logger)
|
|
|
|
|
if err := idx.ReindexAll(context.Background()); err != nil {
|
|
|
|
|
r.logger.Warn("Elasticsearch auto-reindex failed", zap.Error(err))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
searchSvc = elasticsearch.NewSearchService(esClient, r.logger)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
searchSvc = services.NewSearchService(r.db, r.logger)
|
|
|
|
|
}
|
|
|
|
|
handlers.NewSearchHandlersWithInterface(searchSvc)
|
chore: consolidate CI, E2E, backend and frontend updates
- CI: workflows updates (cd, ci), remove playwright.yml
- E2E: global-setup, auth/playlists/profile specs
- Remove playwright-report and test-results artifacts from tracking
- Backend: auth, handlers, services, workers, migrations
- Frontend: components, features, vite config
- Add e2e-results.json to gitignore
- Docs: REMEDIATION_PROGRESS, audit archive
- Rust: chat-server, stream-server updates
2026-02-17 15:43:21 +00:00
|
|
|
router.GET("/search", handlers.SearchHandlersInstance.Search)
|
2026-02-20 15:54:17 +00:00
|
|
|
router.GET("/search/suggestions", handlers.SearchHandlersInstance.Suggestions)
|
chore: consolidate CI, E2E, backend and frontend updates
- CI: workflows updates (cd, ci), remove playwright.yml
- E2E: global-setup, auth/playlists/profile specs
- Remove playwright-report and test-results artifacts from tracking
- Backend: auth, handlers, services, workers, migrations
- Frontend: components, features, vite config
- Add e2e-results.json to gitignore
- Docs: REMEDIATION_PROGRESS, audit archive
- Rust: chat-server, stream-server updates
2026-02-17 15:43:21 +00:00
|
|
|
}
|