I built a custom directive to enable searching with Algolia:
https://github.com/thefinnomenon/graphql-algolia-transformer
It has been a pleasure building MVPs with Amplify but I was annoyed at the monthly cost of Elasticsearch and wanted a search that fits the Serverless "pay per use" model -- enter Algolia. It has a decent free monthly quota so you can make a low cost MVP or small app. It also has a really simple management interface and solid client libraries and UI widgets.
I created a simple searchable blog example (which turned more into a recipe search 😆) that can be found in the Github repo. If you need to add search to your Amplify project, give this transformer a shot.
type Blog @model {
id: ID!
name: String!
posts: [Post] @connection(keyName: "byBlog", fields: ["id"])
}
type Post @model @algolia(fields:{include:["title"]}) @key(name: "byBlog", fields: ["blogID"]) {
id: ID!
title: String!
blogID: ID!
blog: Blog @connection(fields: ["blogID"])
comments: [Comment] @connection(keyName: "byPost", fields: ["id"])
}
type Comment @model @key(name: "byPost", fields: ["postID", "content"]) {
id: ID!
postID: ID!
post: Post @connection(fields: ["postID"])
content: String!
}
Top comments (0)