feat(blog): add Postgres full-text search post - #8093
Conversation
Part 5 of the Postgres features series: ranked search with a generated tsvector column, GIN index, websearch_to_tsquery, and ts_rank, plus pg_trgm typo tolerance, demoed on a temporary Prisma Postgres database. All SQL outputs are real captures from PostgreSQL 17.2. Also links part 4 forward via its next: frontmatter pointer.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds a blog article explaining Postgres full-text search, a runnable Bun and TypeScript demonstration with trigram typo recovery, guidance on Elasticsearch tradeoffs, and series navigation updates. ChangesPostgres Search Article
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/blog/content/blog/you-dont-need-elasticsearch-postgres-already-has-full-text-search/index.mdx (1)
186-207: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winSurface the actual
create-dbfailure reason instead of a generic error.When
create()fails, the CLI's--jsonoutput returns{ success: false, error, message, ... }with noconnectionString. The current check only tests!connectionStringand throws a generic message, discarding the real cause (auth failure, quota, region unavailable, etc.), which makes the demo harder to debug for readers who hit a failure.♻️ Proposed fix to surface the real error
const output = await $`bunx create-db@latest --region eu-central-1 --json` .quiet() .json(); - const connectionString = output.connectionString; - - if (!connectionString) { - throw new Error("Could not find a connection string."); - } + if (!output.success || !output.connectionString) { + throw new Error( + `Failed to create database: ${output.message ?? "unknown error"}`, + ); + } + + const connectionString = output.connectionString;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/blog/content/blog/you-dont-need-elasticsearch-postgres-already-has-full-text-search/index.mdx` around lines 186 - 207, Update createDatabase to inspect the create-db JSON result’s success/error/message fields before the connectionString check. When creation fails or no connection string is returned, throw an error that includes the CLI-provided failure details, while preserving the existing URL setup and readiness flow for successful results.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@apps/blog/content/blog/you-dont-need-elasticsearch-postgres-already-has-full-text-search/index.mdx`:
- Around line 186-207: Update createDatabase to inspect the create-db JSON
result’s success/error/message fields before the connectionString check. When
creation fails or no connection string is returned, throw an error that includes
the CLI-provided failure details, while preserving the existing URL setup and
readiness flow for successful results.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 67a372d5-ce89-46fa-9b53-f75ffb2c4c23
⛔ Files ignored due to path filters (2)
apps/blog/public/you-dont-need-elasticsearch-postgres-already-has-full-text-search/imgs/hero.svgis excluded by!**/*.svgapps/blog/public/you-dont-need-elasticsearch-postgres-already-has-full-text-search/imgs/meta.pngis excluded by!**/*.png
📒 Files selected for processing (2)
apps/blog/content/blog/you-dont-need-a-job-queue-postgres-already-has-skip-locked/index.mdxapps/blog/content/blog/you-dont-need-elasticsearch-postgres-already-has-full-text-search/index.mdx
Summary
Part 5 of the Postgres features series: You Don't Need Elasticsearch, Postgres Already Has Full-Text Search.
tsvectorcolumn, a GIN index,websearch_to_tsquery, andts_rank, withsetweighttitle/body weightingpg_trgmwith a trigram "did you mean" fallbackpgdemo against a temporary Prisma Postgres database (npx create-db)next:series pointerVerification
Summary by CodeRabbit