検索API
GraphQL で検索 API をどうやって作るか?
FilterInput
code:graphql
input ItemFilter {
ne: String
eq: String
le: String
lt: String
ge: String
gt: String
}
type Query {
liteItems(filter: ItemFilter): ItemConnection
}
クエリ文字列
クエリ文字列と検索対象を指定する
code:graphql
"""
Perform a search across resources.
"""
search(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
"""
The search string to look for.
"""
query: String!
"""
The types of search items to search within.
"""
type: SearchType!
): SearchResultItemConnection!