graphile-plugin-fulltext-filter 2.0.2 โ 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -13
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -8,19 +8,31 @@
|
|
|
8
8
|
<a href="https://github.com/launchql/launchql/actions/workflows/run-tests.yaml">
|
|
9
9
|
<img height="20" src="https://github.com/launchql/launchql/actions/workflows/run-tests.yaml/badge.svg" />
|
|
10
10
|
</a>
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
<a href="https://github.com/launchql/launchql/blob/main/LICENSE">
|
|
12
|
+
<img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/>
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/graphile-plugin-fulltext-filter">
|
|
15
|
+
<img height="20" src="https://img.shields.io/github/package-json/v/launchql/launchql?filename=graphile%2Fgraphile-plugin-fulltext-filter%2Fpackage.json"/>
|
|
16
|
+
</a>
|
|
13
17
|
</p>
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
**`graphile-plugin-fulltext-filter`** adds full-text search operators for `tsvector` fields to `graphile-plugin-connection-filter` in PostGraphile v4.
|
|
16
20
|
|
|
17
|
-
##
|
|
21
|
+
## ๐ Installation
|
|
18
22
|
|
|
19
23
|
```sh
|
|
20
24
|
pnpm add graphile-plugin-fulltext-filter
|
|
21
25
|
```
|
|
22
26
|
|
|
23
|
-
##
|
|
27
|
+
## โจ Features
|
|
28
|
+
|
|
29
|
+
- Adds a `matches` operator for `tsvector` columns in PostGraphile v4
|
|
30
|
+
- Works alongside `graphile-plugin-connection-filter`
|
|
31
|
+
- Generates rank fields for ordering results (`fullTextRank`)
|
|
32
|
+
- CLI and library-friendly setup
|
|
33
|
+
- Uses `pg-tsquery` to safely parse user input
|
|
34
|
+
|
|
35
|
+
## ๐ฆ Usage
|
|
24
36
|
|
|
25
37
|
### CLI
|
|
26
38
|
|
|
@@ -52,7 +64,7 @@ app.use(
|
|
|
52
64
|
app.listen(5000);
|
|
53
65
|
```
|
|
54
66
|
|
|
55
|
-
## Performance
|
|
67
|
+
## โก Performance
|
|
56
68
|
|
|
57
69
|
All `tsvector` columns that aren't `@omit`'d should have indexes on them:
|
|
58
70
|
|
|
@@ -61,19 +73,19 @@ ALTER TABLE posts ADD COLUMN full_text tsvector;
|
|
|
61
73
|
CREATE INDEX full_text_idx ON posts USING gin(full_text);
|
|
62
74
|
```
|
|
63
75
|
|
|
64
|
-
## Operators
|
|
76
|
+
## ๐ Operators
|
|
65
77
|
|
|
66
78
|
This plugin adds the `matches` filter operator to the filter plugin, accepting a GraphQL String input and using the `@@` operator to perform full-text searches on `tsvector` columns.
|
|
67
79
|
|
|
68
80
|
This plugin uses [pg-tsquery](https://github.com/caub/pg-tsquery) to parse the user input to prevent Postgres throwing on bad user input unnecessarily.
|
|
69
81
|
|
|
70
|
-
## Fields
|
|
82
|
+
## ๐งญ Fields
|
|
71
83
|
|
|
72
84
|
For each `tsvector` column, a rank column will be automatically added to the GraphQL type for the table by appending `Rank` to the end of the column's name. For example, a column `full_text` will appear as `fullText` in the GraphQL type, and a second column, `fullTextRank` will be added to the type as a `Float`.
|
|
73
85
|
|
|
74
86
|
This rank field can be used for ordering and is automatically added to the orderBy enum for the table.
|
|
75
87
|
|
|
76
|
-
## Examples
|
|
88
|
+
## ๐งช Examples
|
|
77
89
|
|
|
78
90
|
```graphql
|
|
79
91
|
query {
|
|
@@ -89,14 +101,13 @@ query {
|
|
|
89
101
|
}
|
|
90
102
|
```
|
|
91
103
|
|
|
92
|
-
## Testing
|
|
104
|
+
## ๐งช Testing
|
|
93
105
|
|
|
94
106
|
```sh
|
|
95
|
-
|
|
107
|
+
# requires a local Postgres available (defaults to postgres/password@localhost:5432)
|
|
108
|
+
pnpm --filter graphile-plugin-fulltext-filter test
|
|
96
109
|
```
|
|
97
110
|
|
|
98
|
-
Tests expect a running PostgreSQL instance. See test configuration for database connection details.
|
|
99
|
-
|
|
100
111
|
---
|
|
101
112
|
|
|
102
113
|
## Education and Tutorials
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-plugin-fulltext-filter",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Full text searching on tsvector fields for use with graphile-plugin-connection-filter",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"graphile-build": "^4.14.1",
|
|
44
44
|
"graphile-build-pg": "^4.14.1",
|
|
45
|
-
"graphile-plugin-connection-filter": "^2.3.
|
|
45
|
+
"graphile-plugin-connection-filter": "^2.3.3",
|
|
46
46
|
"pg-tsquery": "^8.1.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"graphile-plugin-connection-filter": "workspace:^",
|
|
54
|
-
"graphile-test": "^2.8.
|
|
54
|
+
"graphile-test": "^2.8.11",
|
|
55
55
|
"graphql": "15.10.1",
|
|
56
56
|
"makage": "^0.1.8",
|
|
57
|
-
"pgsql-test": "^2.14.
|
|
57
|
+
"pgsql-test": "^2.14.14"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "00c90828cab8d3e306ebb2bc6053aab4aa9ae807"
|
|
60
60
|
}
|