Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

spacefill/postgraphile-plugin-unaccented-text-search-filter

Repository files navigation

Package on npm

postgraphile-plugin-unaccented-text-search-filter

Adds unaccent string filtering capabilities to a PostGraphile schema.

This plugin extends the postgraphile-plugin-connection-filter plugin with unaccentuated text filter operators.

This plugin supports filtering on all PostgreSQL string types: char, varchar, text.

Plugin Options

When using PostGraphile as a library, many options can be passed via graphileBuildOptions. See here for more information.

Examples

query {
  allPosts(filter: {
    body: { includesUnaccentInsensitive: "Solidarité" }
  }) {
    ...
  }
}

For an extensive set of examples, see docs/examples.md.

Development

Requirements

Then you must initialize dependancies:

$ direnv allow
$ asdf install
$ asdf reshim

Tests

To establish a test environment, you must create an empty PostgreSQL database with C collation (required for consistent ordering of strings):

$ docker-compose up -d

Install nodejs dependencies:

$ yarn install

Run tests:

$ yarn run test
yarn run v1.22.17
$ jest -i
 PASS  __tests__/integration/queries.test.ts
  ✓ types.char4.graphql (44 ms)
  ✓ types.text.graphql (22 ms)
  ✓ types.varchar64.graphql (22 ms)

Test Suites: 1 passed, 1 total
Tests:       3 passed, 3 total
Snapshots:   3 passed, 3 total
Time:        3.7 s
Ran all test suites.
✨  Done in 4.61s.

Release

Every tag is released with the according version.

Deploy a new release

Bump version in package.json

Create a PR to release with the bumped version. When your PR is merged on master create and push tag:

$ ./scripts/create-and-push-tag.sh

This will automatically create a new local tag and push it. Then the CI will release a new version on npm.

About

Filtering on PostGraphile connections using UNACCENT extension

Resources

License

Stars

Watchers

Forks

Packages

No packages published