-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support language stemmers #7
Comments
FlexSearch language support: Lunr language support: |
Hey, I would like to tackle this one. I already commented here #31 (comment) So I would like to propose a way to hook into the plugin code to allow extended configuration of each engine. Here is an example: // types.ts
export type FlexSearchEngine = {
name: 'flexsearch',
options: FlexSearchCreateOptions
hook?: (engine: FlexSearch) => void
}
export type LunrEngine = {
name: 'lunr',
options: any
hook?: LunrConfigFunction
}
export type Engine = FlexSearchEngine | LunrEngine
// gatsby-node.ts
// ...
// Inside createFlexSearchIndexExport
if (engine.hook) {
engine.hook(FlexSearch)
}
const index = FlexSearch.create<IndexableDocument>(engine.options)
// ... This could allow to register new plugins/stemmers and whatever the user wants. I don't know if you have this in mind or something less prone to mess with the engine. But I feel this could give enough power to customize each possible engine we integrate in this plugin. Should I provide some POC ? EDIT: Sorry I should have read all issues of this repo, and open my own, This feature could close many issue still pending. |
Add language support.
To support multiple engines, the best API is probably passing a language string (e.g. “en” or “de”).
Alternatively, allow passing arbitrary Stemmer configs. This would be engine-specific.
The text was updated successfully, but these errors were encountered: