Developing a Search Feature for BOLT.FUN. Onboarding.
Hey wamy.
So in this story, I'll be going over the parts you will need to develop the search feature as we discussed on our last meeting.
Front-End
I believe things should be relatively clear here.
We use tailwind for all of our components, & we have a lot of reusable "atomic" components that you can find in the "Components" folder.
We also already have a Search feature but that only searches projects.
You can see it in the website on the "Explore Projects" page on the navbar.
In code, it's in the 'src/Components/Navbar/Search
' folder.
Maybe you can make use of some parts of it instead of starting from scratch. It's up to you.
Back-End
For the initial seeding of existing data: It will be done using a one-time run script written in something like Python.
This won't have anything to do with our current back-end.
For keeping the search DB in sync with the real DB, we will be doing that using a new service.
On our bolt.fun-queue service, we will create a new queue & worker for that queue which will receives new jobs whenever some entity we care about in the real DB was updated.
So for example, in our createStory
graphql mutation, at the end of the mutation function, we will make an API request to the queue service asking it to create a new "EntityUpdate
" job, & it will send some data along like:
{
type: "Story",
action: "create" | "delete" | "update",
payload: {
// the new entity's fields (most importantly the id)
}
}
What the worker will do is whenever it recieves new jobs on this queue, it will update the Meilisearch DB/Index accordingly.
& I think that's everything we need!