Package Exports
- graphile-plugin-fulltext-filter
- graphile-plugin-fulltext-filter/esm/index.js
- graphile-plugin-fulltext-filter/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (graphile-plugin-fulltext-filter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
graphile-plugin-fulltext-filter
graphile-plugin-fulltext-filter adds full-text search operators for tsvector fields to graphile-plugin-connection-filter in PostGraphile v4.
🚀 Installation
pnpm add graphile-plugin-fulltext-filter✨ Features
- Adds a
matchesoperator fortsvectorcolumns in PostGraphile v4 - Works alongside
graphile-plugin-connection-filter - Generates rank fields for ordering results (
fullTextRank) - CLI and library-friendly setup
- Uses
pg-tsqueryto safely parse user input
📦 Usage
CLI
postgraphile --append-plugins graphile-plugin-connection-filter,graphile-plugin-fulltext-filterSee here for more information about loading plugins with PostGraphile.
Library
const express = require('express');
const { postgraphile } = require('postgraphile');
const PostGraphileConnectionFilterPlugin = require('graphile-plugin-connection-filter');
const FulltextFilterPlugin = require('graphile-plugin-fulltext-filter');
const app = express();
app.use(
postgraphile(pgConfig, schema, {
appendPlugins: [
PostGraphileConnectionFilterPlugin,
FulltextFilterPlugin,
],
})
);
app.listen(5000);⚡ Performance
All tsvector columns that aren't @omit'd should have indexes on them:
ALTER TABLE posts ADD COLUMN full_text tsvector;
CREATE INDEX full_text_idx ON posts USING gin(full_text);🔎 Operators
This plugin adds the matches filter operator to the filter plugin, accepting a GraphQL String input and using the @@ operator to perform full-text searches on tsvector columns.
This plugin uses pg-tsquery to parse the user input to prevent Postgres throwing on bad user input unnecessarily.
🧭 Fields
For each tsvector column, a rank column will be automatically added to the GraphQL type for the table by appending Rank to the end of the column's name. For example, a column full_text will appear as fullText in the GraphQL type, and a second column, fullTextRank will be added to the type as a Float.
This rank field can be used for ordering and is automatically added to the orderBy enum for the table.
🧪 Examples
query {
allPosts(
filter: {
fullText: { matches: 'foo -bar' }
}
orderBy: FULL_TEXT_RANK_DESC
) {
...
fullTextRank
}
}🧪 Testing
# requires a local Postgres available (defaults to postgres/password@localhost:5432)
pnpm --filter graphile-plugin-fulltext-filter testEducation and Tutorials
🚀 Quickstart: Getting Up and Running Get started with modular databases in minutes. Install prerequisites and deploy your first module.
📦 Modular PostgreSQL Development with Database Packages Learn to organize PostgreSQL projects with pgpm workspaces and reusable database modules.
✏️ Authoring Database Changes Master the workflow for adding, organizing, and managing database changes with pgpm.
🧪 End-to-End PostgreSQL Testing with TypeScript Master end-to-end PostgreSQL testing with ephemeral databases, RLS testing, and CI/CD automation.
⚡ Supabase Testing Use TypeScript-first tools to test Supabase projects with realistic RLS, policies, and auth contexts.
💧 Drizzle ORM Testing Run full-stack tests with Drizzle ORM, including database setup, teardown, and RLS enforcement.
🔧 Troubleshooting Common issues and solutions for pgpm, PostgreSQL, and testing.
Related Constructive Tooling
🧪 Testing
- pgsql-test: 📊 Isolated testing environments with per-test transaction rollbacks—ideal for integration tests, complex migrations, and RLS simulation.
- supabase-test: 🧪 Supabase-native test harness preconfigured for the local Supabase stack—per-test rollbacks, JWT/role context helpers, and CI/GitHub Actions ready.
- graphile-test: 🔐 Authentication mocking for Graphile-focused test helpers and emulating row-level security contexts.
- pg-query-context: 🔒 Session context injection to add session-local context (e.g.,
SET LOCAL) into queries—ideal for settingrole,jwt.claims, and other session settings.
🧠 Parsing & AST
- pgsql-parser: 🔄 SQL conversion engine that interprets and converts PostgreSQL syntax.
- libpg-query-node: 🌉 Node.js bindings for
libpg_query, converting SQL into parse trees. - pg-proto-parser: 📦 Protobuf parser for parsing PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
- @pgsql/enums: 🏷️ TypeScript enums for PostgreSQL AST for safe and ergonomic parsing logic.
- @pgsql/types: 📝 Type definitions for PostgreSQL AST nodes in TypeScript.
- @pgsql/utils: 🛠️ AST utilities for constructing and transforming PostgreSQL syntax trees.
🚀 API & Dev Tools
- @constructive-io/graphql-server: ⚡ Express-based API server powered by PostGraphile to expose a secure, scalable GraphQL API over your Postgres database.
- @constructive-io/graphql-explorer: 🔎 Visual API explorer with GraphiQL for browsing across all databases and schemas—useful for debugging, documentation, and API prototyping.
🔁 Streaming & Uploads
- etag-hash: 🏷️ S3-compatible ETags created by streaming and hashing file uploads in chunks.
- etag-stream: 🔄 ETag computation via Node stream transformer during upload or transfer.
- uuid-hash: 🆔 Deterministic UUIDs generated from hashed content, great for deduplication and asset referencing.
- uuid-stream: 🌊 Streaming UUID generation based on piped file content—ideal for upload pipelines.
- @constructive-io/s3-streamer: 📤 Direct S3 streaming for large files with support for metadata injection and content validation.
- @constructive-io/upload-names: 📂 Collision-resistant filenames utility for structured and unique file names for uploads.
🧰 CLI & Codegen
- pgpm: 🖥️ PostgreSQL Package Manager for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
- @constructive-io/cli: 🖥️ Command-line toolkit for managing Constructive projects—supports database scaffolding, migrations, seeding, code generation, and automation.
- @constructive-io/graphql-codegen: ✨ GraphQL code generation (types, operations, SDK) from schema/endpoint introspection.
- @constructive-io/query-builder: 🏗️ SQL constructor providing a robust TypeScript-based query builder for dynamic generation of
SELECT,INSERT,UPDATE,DELETE, and stored procedure calls—supports advanced SQL features likeJOIN,GROUP BY, and schema-qualified queries. - @constructive-io/graphql-query: 🧩 Fluent GraphQL builder for PostGraphile schemas. ⚡ Schema-aware via introspection, 🧩 composable and ergonomic for building deeply nested queries.
Credits
🛠 Built by the Constructive team — creators of modular Postgres tooling for secure, composable backends. If you like our work, contribute on GitHub.
Disclaimer
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.