Skip to content

Conversation

@Bhup-GitHUB
Copy link

@Bhup-GitHUB Bhup-GitHUB commented Dec 9, 2025

Summary #146

  • Implemented /api/where/search/route.json using SQLite FTS5 for full-text route search, matching OneBusAway’s route search spec.
  • Added routes_fts virtual table with triggers to keep FTS data in sync and a rebuild to cover existing data.
  • Introduced sqlc-backed SearchRoutesByFullText query and GTFS manager helper that builds safe prefix queries and caps result size.
  • Added REST handler that validates required input, checks maxCount, and returns list + references consistent with existing /where endpoints.
  • Switched to pure-Go modernc.org/sqlite to ensure FTS5 is available in tests/builds without native SQLite deps.
  • Added comprehensive handler tests (auth failure, happy path, validation of required input and maxCount) plus a Windows-safe path fix in the config build test.

Implementation Notes

  • Schema: new FTS5 virtual table routes_fts with insert/update/delete triggers; rebuild inserted to backfill existing routes.
  • Data access: new sqlc query SearchRoutesByFullText; manager helper constructs FTS-safe "term"* AND-joined queries with limits.
  • HTTP: new handler wired in internal/restapi/routes.go; uses existing validation/response helpers to match schema of other list endpoints.
  • Driver: replaced github.com/mattn/go-sqlite3 with modernc.org/sqlite for FTS5 availability across environments.

Testing

  • go test ./...

Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate your help, but any solution that reverts the very intentional DB driver change I made two months ago isn't going to work, unfortunately. Bhup-GitHUB@fae9999

@aaronbrethorst aaronbrethorst self-assigned this Dec 9, 2025
@aaronbrethorst
Copy link
Member

@Bhup-GitHUB The README on https://github.com/mattn/go-sqlite3 explains how to enable fts5. You just need to read it and apply it.

@Bhup-GitHUB
Copy link
Author

@Bhup-GitHUB The README on https://github.com/mattn/go-sqlite3 explains how to enable fts5. You just need to read it and apply it.

Thanks for the guidance. I’ll keep the github.com/mattn/go-sqlite3 driver and enable FTS5 per the README by building/testing with -tags "sqlite_fts5" (with CGO enabled). I’ll also document the build flag so others can run the suite successfully. Does this approach align with what you want?

@aaronbrethorst
Copy link
Member

aaronbrethorst commented Dec 9, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants