Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Package on npm CircleCI

postgraphile-plugin-zombodb

This plugin implements a full text search operator for tables that have a ZomboDB index, using Elasticsearch.

Getting Started

CLI

postgraphile --append-plugins postgraphile-plugin-zombodb

See here for more information about loading plugins with PostGraphile.

Library

const express = require('express');
const { postgraphile } = require('postgraphile');
const PostGraphileZomboDBPlugin = require('postgraphile-plugin-zombodb');

const app = express();

app.use(
  postgraphile(pgConfig, schema, {
    appendPlugins: [
      PostGraphileZomboDBPlugin,
    ],
  })
);

app.listen(5000);

Schema

The plugin discovers all ZomboDB indexes and adds a search input argument for each table with an index. For help with getting started with ZomboDB, check out the tutorial.

Searching

The plugin passes the search string directly to the ZomboDB extension. See ZomboDB's Query DSL documentation for how to structure queries.

Scoring

A Float score column will be automatically added to the GraphQL type for each indexed table, named _score by default.

This score field can be used for ordering and is automatically added to the orderBy enum for the table.

Examples

query {
  allPosts(
    search: {
      query: "+cat and +dog"
      minScore: 0.5
    }
    orderBy: _SCORE_DESC
  }) {
    ...
    _score
  }
}

To Do

  • This plugin does not yet map limit/offset and order by parameters into ZomboDB's query DSL, and so searches on huge tables may not be particularly performant.
  • Match highlighting.
  • Structured queries.

About

PostGraphile plugin for full text searching using ZomboDB

Resources

License

Packages

No packages published