Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjie benjie

View GitHub Profile
@benjie
benjie / postgraphile-tsv-plugin.js
Last active Jun 24, 2018 — forked from mlipscombe/postgraphile-tsv-plugin.js
full text search plugin for postgraphile (edited)
View postgraphile-tsv-plugin.js
const TSVECTOR_TYPE_ID = 3614;
export const PostGraphileTSVPlugin = builder => {
builder.hook('infection', (inflection, build) => {
return build.extend(inflection, {
fullTextScalarTypeName() {
return `FullText`;
},
pgTsvRank(fieldName) {
return this.camelCase(`${fieldName}-rank`);