This plugin implements a full text search operator for tables that have a ZomboDB index, using Elasticsearch.
postgraphile --append-plugins postgraphile-plugin-zombodb
See here for more information about loading plugins with PostGraphile.
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);
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.
The plugin passes the search string directly to the ZomboDB extension. See ZomboDB's Query DSL documentation for how to structure queries.
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.
query {
allPosts(
search: {
query: "+cat and +dog"
minScore: 0.5
}
orderBy: _SCORE_DESC
}) {
...
_score
}
}
- This plugin does not yet map
limit
/offset
andorder by
parameters into ZomboDB's query DSL, and so searches on huge tables may not be particularly performant. - Match highlighting.
- Structured queries.