Skip to content

Commit

Permalink
Implement preable passthrough to GQL search.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinstubbs committed Sep 5, 2024
1 parent e9db4dd commit 61c7d15
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-parrots-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@pantheon-systems/pcc-sdk-core": patch
---

Add 'preamble' property for searches with summary.
2 changes: 2 additions & 0 deletions packages/core/src/helpers/articles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface ArticleQueryArgs {
sortBy?: keyof typeof ArticleSortField;
sortOrder?: keyof typeof SortOrder;
metadataFilters?: { [key: string]: unknown };
preamble?: string;
}

export interface ArticlePaginatedQueryArgs {
Expand All @@ -40,6 +41,7 @@ export interface ArticlePaginatedQueryArgs {
metadataFilters?: { [key: string]: unknown };
pageSize?: number;
cursor?: string;
preamble?: string;
}

type FilterableFields = "body" | "tag" | "title";
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/lib/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export function generateListArticlesGQL({
$contentType: ContentType
$publishingLevel: PublishingLevel
$filter: ArticleFilterInput
$premable: String
) {
articlesv3(
pageSize: $pageSize
Expand All @@ -83,6 +84,7 @@ export function generateListArticlesGQL({
contentType: $contentType
publishingLevel: $publishingLevel
filter: $filter
preamble: $preamble
) {
articles {
id
Expand Down
2 changes: 0 additions & 2 deletions starters/nextjs-starter-ts/pages/api/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export default async function handler(
publishingLevel: "PRODUCTION",
},
{
titleContains: q,
tagContains: q,
bodyContains: q,
},
true,
Expand Down
2 changes: 0 additions & 2 deletions starters/nextjs-starter/pages/api/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export default async function handler(req, res) {
publishingLevel: "PRODUCTION",
},
{
titleContains: q,
tagContains: q,
bodyContains: q,
},
true,
Expand Down

0 comments on commit 61c7d15

Please sign in to comment.