Skip to content
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

Open
angeloashmore opened this issue Aug 10, 2019 · 2 comments
Open

Support language stemmers #7

angeloashmore opened this issue Aug 10, 2019 · 2 comments

Comments

@angeloashmore
Copy link
Owner

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.

@angeloashmore
Copy link
Owner Author

@jooola
Copy link

jooola commented May 7, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants