postgraphile-plugin-zombodb v1.0.0-beta.5
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-zombodbSee 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/offsetandorder byparameters into ZomboDB's query DSL, and so searches on huge tables may not be particularly performant. - Match highlighting.
- Structured queries.
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago