Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
338 changes: 338 additions & 0 deletions graphql/codegen/examples/example-bm25.schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,338 @@
"""A universally unique identifier as defined by [RFC 4122](https://tools.ietf.org/html/rfc4122)."""
scalar UUID

"""
A point in time as described by the [ISO
8601](https://en.wikipedia.org/wiki/ISO_8601) standard. May or may not include a timezone.
"""
scalar Datetime

"""A location as described by the [GeoJSON](https://geojson.org/) format."""
scalar JSON

"""A string representing a cursor for pagination."""
scalar Cursor

"""Full-text search scalar type."""
scalar FullText

"""The root query type."""
type Query {
"""Reads and enables pagination through a set of `Article`."""
articles(
first: Int
last: Int
offset: Int
before: Cursor
after: Cursor
orderBy: [ArticlesOrderBy!] = [PRIMARY_KEY_ASC]
filter: ArticleFilter
condition: ArticleCondition
): ArticlesConnection

"""Reads a single `Article` using its globally unique `ID`."""
article(id: UUID!): Article

"""Reads and enables pagination through a set of `Post`."""
posts(
first: Int
last: Int
offset: Int
before: Cursor
after: Cursor
orderBy: [PostsOrderBy!] = [PRIMARY_KEY_ASC]
filter: PostFilter
condition: PostCondition
): PostsConnection

"""Reads a single `Post` using its globally unique `ID`."""
post(id: UUID!): Post
}

"""The root mutation type."""
type Mutation {
"""Creates a single `Article`."""
createArticle(input: CreateArticleInput!): CreateArticlePayload

"""Updates a single `Article` using its globally unique `ID`."""
updateArticle(input: UpdateArticleInput!): UpdateArticlePayload

"""Deletes a single `Article` using its globally unique `ID`."""
deleteArticle(input: DeleteArticleInput!): DeleteArticlePayload

"""Creates a single `Post`."""
createPost(input: CreatePostInput!): CreatePostPayload

"""Updates a single `Post` using its globally unique `ID`."""
updatePost(input: UpdatePostInput!): UpdatePostPayload

"""Deletes a single `Post` using its globally unique `ID`."""
deletePost(input: DeletePostInput!): DeletePostPayload
}

# ============================================================================
# Entity Types
# ============================================================================

type Article {
id: UUID!
title: String!
body: String!
createdAt: Datetime!
updatedAt: Datetime
}

type Post {
id: UUID!
title: String!
content: String
createdAt: Datetime!
}

# ============================================================================
# Enums
# ============================================================================

enum ArticlesOrderBy {
NATURAL
PRIMARY_KEY_ASC
PRIMARY_KEY_DESC
ID_ASC
ID_DESC
TITLE_ASC
TITLE_DESC
CREATED_AT_ASC
CREATED_AT_DESC
"""Sort by BM25 relevance score for body column (ascending = best matches first)."""
BM25_BODY_SCORE_ASC
"""Sort by BM25 relevance score for body column (descending)."""
BM25_BODY_SCORE_DESC
}

enum PostsOrderBy {
NATURAL
PRIMARY_KEY_ASC
PRIMARY_KEY_DESC
ID_ASC
ID_DESC
TITLE_ASC
TITLE_DESC
CREATED_AT_ASC
CREATED_AT_DESC
"""Sort by BM25 relevance score for content column (ascending = best matches first)."""
BM25_CONTENT_SCORE_ASC
"""Sort by BM25 relevance score for content column (descending)."""
BM25_CONTENT_SCORE_DESC
}

# ============================================================================
# Connection Types
# ============================================================================

type ArticlesConnection {
nodes: [Article!]!
edges: [ArticlesEdge!]!
pageInfo: PageInfo!
totalCount: Int!
}

type ArticlesEdge {
node: Article!
cursor: Cursor!
}

type PostsConnection {
nodes: [Post!]!
edges: [PostsEdge!]!
pageInfo: PageInfo!
totalCount: Int!
}

type PostsEdge {
node: Post!
cursor: Cursor!
}

type PageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: Cursor
endCursor: Cursor
}

# ============================================================================
# Filter Types
# ============================================================================

input ArticleFilter {
id: UUIDFilter
title: StringFilter
body: StringFilter
and: [ArticleFilter!]
or: [ArticleFilter!]
not: ArticleFilter
}

input PostFilter {
id: UUIDFilter
title: StringFilter
and: [PostFilter!]
or: [PostFilter!]
not: PostFilter
}

input UUIDFilter {
equalTo: UUID
notEqualTo: UUID
in: [UUID!]
notIn: [UUID!]
isNull: Boolean
}

input StringFilter {
equalTo: String
notEqualTo: String
in: [String!]
notIn: [String!]
includes: String
startsWith: String
endsWith: String
isNull: Boolean
}

input BooleanFilter {
equalTo: Boolean
notEqualTo: Boolean
isNull: Boolean
}

# ============================================================================
# Condition Types (includes plugin-injected BM25 search fields)
# ============================================================================

"""
Condition type for Article table.
Includes standard column equality fields plus plugin-injected BM25 search fields.
"""
input ArticleCondition {
id: UUID
title: String
body: String

"""BM25 ranked text search on the body column (injected by Bm25SearchPlugin)."""
bm25Body: Bm25SearchInput
}

"""
Condition type for Post table.
Includes standard column equality fields plus plugin-injected BM25 search fields.
"""
input PostCondition {
id: UUID
title: String
content: String

"""BM25 ranked text search on the content column (injected by Bm25SearchPlugin)."""
bm25Content: Bm25SearchInput
}

"""
Input type for BM25 ranked text search.
Injected by Bm25SearchPlugin into condition types for text columns with BM25 indexes.
"""
input Bm25SearchInput {
"""The search query text. Uses pg_textsearch BM25 ranking."""
query: String!
"""Maximum BM25 score threshold (negative values). Only rows with score <= threshold are returned."""
threshold: Float
}

# ============================================================================
# Mutation Input Types
# ============================================================================

input CreateArticleInput {
clientMutationId: String
article: ArticleInput!
}

input ArticleInput {
title: String!
body: String!
}

input UpdateArticleInput {
clientMutationId: String
id: UUID!
patch: ArticlePatch!
}

input ArticlePatch {
title: String
body: String
}

input DeleteArticleInput {
clientMutationId: String
id: UUID!
}

input CreatePostInput {
clientMutationId: String
post: PostInput!
}

input PostInput {
title: String!
content: String
}

input UpdatePostInput {
clientMutationId: String
id: UUID!
patch: PostPatch!
}

input PostPatch {
title: String
content: String
}

input DeletePostInput {
clientMutationId: String
id: UUID!
}

# ============================================================================
# Mutation Payload Types
# ============================================================================

type CreateArticlePayload {
clientMutationId: String
article: Article
}

type UpdateArticlePayload {
clientMutationId: String
article: Article
}

type DeleteArticlePayload {
clientMutationId: String
article: Article
}

type CreatePostPayload {
clientMutationId: String
post: Post
}

type UpdatePostPayload {
clientMutationId: String
post: Post
}

type DeletePostPayload {
clientMutationId: String
post: Post
}
Loading
Loading