ilorm-plugin-algolia
This plugin adds binding between your data and algolia.
Schema
With this plugin enabled you can define which fields will be stored in your database and in algolia.
const Schema = ; const userSchema = email: Schema firstName: Schema
Declare model index
const algoliasearch = ;const newModel = ; const client = ; const UserModel =
Search
With algolia enabled on your model, you will have a new search method on the query
const User = ; const user = await User ;
How it's work?
- At save and remove classic model method, the associated algolia index will be updated (upsert instance or remove from index).
- At query, the Query will first search in algolia, and filtering with the returning ObjectId the query to the main database.