Skip to content
WorldOccupierPublic

About

Backend for retrieving search results

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gosearch

Backend for retrieving search results using TF-IDF ranking.

Architecture

  • Framework: Gin (HTTP router)
  • Database: PostgreSQL with pgx/v5 driver
  • Search: TF-IDF scoring via SQL query over t_url_term_count and t_metadata tables

Prerequisites

  • Go 1.26+
  • Docker & Docker Compose (for containerized run)
  • PostgreSQL (for local-only run)

Quick Start (Docker)

make up

This builds the Docker image and starts the service on port 8080.

You can also run directly:

docker compose up -d

Local Build (without Docker)

make localbuild

Then run the binary with a DATABASE_URL environment variable pointing to your Postgres instance:

DATABASE_URL="postgres://user:pass@localhost:5432/goprocess" ./gosearch

API

GET /search?query=

Returns top 10 results ranked by TF-IDF score. Example:

curl "http://localhost:8080/search?query=golang"

Makefile Targets

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

Cleanup

make clean

Or manually:

docker compose down -v

This stops containers and removes persisted volumes.

About

Backend for retrieving search results

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages