Backend for retrieving search results using TF-IDF ranking.
- Framework: Gin (HTTP router)
- Database: PostgreSQL with pgx/v5 driver
- Search: TF-IDF scoring via SQL query over
t_url_term_countandt_metadatatables
- Go 1.26+
- Docker & Docker Compose (for containerized run)
- PostgreSQL (for local-only run)
make upThis builds the Docker image and starts the service on port 8080.
You can also run directly:
docker compose up -dmake localbuildThen run the binary with a DATABASE_URL environment variable pointing to your Postgres instance:
DATABASE_URL="postgres://user:pass@localhost:5432/goprocess" ./gosearchGET /search?query=
Returns top 10 results ranked by TF-IDF score. Example:
curl "http://localhost:8080/search?query=golang"| Target | Description |
|---|---|
up |
Build and start containers |
down |
Stop containers |
rebuild |
Stop, remove volumes, rebuild, start |
logs |
Follow container logs |
clean |
Stop containers and remove volumes |
localbuild |
Build binary locally |
make cleanOr manually:
docker compose down -vThis stops containers and removes persisted volumes.