Custom Search Engine
Build your own Magnify engine by extending MagnifyEngine with update, delete, search, map, paginate and flush, then register it in config/magnify.ts.
If the available Search Engines does not fit your needs you can integrate your own custom search engine.
Writing the Engine
Your Search Engine should extend the MagnifyEngine class and implement the following methods:
import { SearchableModel, SearchableRow } from '@foadonis/magnify/types'
import { } from '@foadonis/magnify'
export class extends {
async (...: SearchableRow[]) {}
async (...: SearchableRow[]) {}
async (: ) {}
async (: , : any) {}
async (: , : number, : number) {}
async (: SearchableModel) {}
}You can head to the natively supported Search Engines source code for more information about the implementation.
Registering the Engine
You can now add your CustomSearchEngine to the config/magnify.ts file:
const = defineConfig({
: 'custom',
: {
: new CustomSearchEngine(),
},
})
export default Searching
Query Searchable models with search(), refine using where, whereIn and whereNotIn, sort with orderBy, and page results through paginate.
Commands
Reference for the Magnify Ace commands: magnify:import, magnify:flush and magnify:sync-index-settings for loading, clearing and configuring search indexes.