-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathexample-bm25.schema.graphql
More file actions
338 lines (282 loc) · 7.23 KB
/
example-bm25.schema.graphql
File metadata and controls
338 lines (282 loc) · 7.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
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
}