t_wの輪郭

Feedlyでフォローするボタン
AmplifyGraphQL Schema
『API (GraphQL) Make your data searchable』AWS Amplify の@searchableが Amazon OpenSearch Serverless に対応して欲しい供養あれAWS AmplifyでGraphQL Schemaに@searchableを設定するとデプロイに時間がかかる

供養

2023/4/1 8:15:00
const graphql_search_post_result = await API.graphql({
  query: searchPosts,
  variables: {
    filter: { or: [{ body_html: { match: query } }, { name: { match: query } }] },
    limit: 100,
    // sort: { direction: "desc", field: "name" },
  },
  authMode: "API_KEY",
  authToken: awsExports.aws_appsync_apiKey
}) as GraphQLResult<SearchPostsQuery>
const posts_search: Post[] = (graphql_search_post_result.data?.searchPosts?.items.filter(post => post) ?? []) as Post[];

const posts_deduped_sorted = [...new Map(search_result.map(p=>[p.id, p])).values()]
  .sort((a, b) => Date.parse(b.updatedOn) - Date.parse(a.updatedOn))
.sort((a,b)=>(b.name==query ? 1 : 0) - (a.name==query ? 1 : 0))
set_posts(posts_deduped_sorted);

あれ

2023/4/1 7:50:00

@searchable、アルファベットだと検索してくれるけど日本語では検索してくれへん