Skip to content

Commit

Permalink
feat: add sortable search (#2623)
Browse files Browse the repository at this point in the history
  • Loading branch information
IcanDivideBy0 authored Dec 10, 2024
1 parent d3c2a58 commit cbabb19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/query/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

To quickly setup the project, add a `.env` file in the `subql/packages/query` folder with the following content:

```
```env
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
Expand All @@ -14,6 +14,6 @@ DB_DATABASE=postgres

then run the following command

```
$ NODE_OPTIONS="-r dotenv/config" yarn start -- --name <subquery_name> --playground
```sh
NODE_OPTIONS="-r dotenv/config" yarn start:dev -- --name <subquery_name> --playground
```
1 change: 1 addition & 0 deletions packages/query/src/graphql/plugins/PgSearchPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const PgSearchPlugin: Plugin = (builder) => {
// Sanitises the search argument for fulltext search using pg-tsquery
builder.hook('GraphQLObjectType:fields:field', (field, build, {scope: {pgFieldIntrospection}}: Context<any>) => {
if (isProcedure(pgFieldIntrospection) && pgFieldIntrospection.argNames.includes('search')) {
pgFieldIntrospection.tags.sortable = true;
return {
...field,
resolve(source, args, ctx, info) {
Expand Down

0 comments on commit cbabb19

Please sign in to comment.