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

Add lunr options search customization #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

meghan-ec
Copy link

Adds the search customization options b and k1 to the lunr per these docs https://lunrjs.com/guides/customising.html

@angeloashmore
Copy link
Owner

Thanks @meghan-ec, I'll review this as soon as I have a free moment. 👍

@jooola
Copy link

jooola commented May 7, 2021

@angeloashmore @meghan-ec I feel this way of passing props downstream will limit too much the ability to extend the underlying engine configuration.

What about using hooks to configure the engine, pre/post index creation ?

Maybe this gives too much freedom to mess the plugin around, but this would allow user to pass plugins or configure languages.

src/types.ts Outdated
Comment on lines 39 to 41
engine: Engine
engineOptions?: FlexSearchCreateOptions | LunrPluginOptions
engineOptions?: FlexSearchCreateOptions
lunrOptions?: any
Copy link

@jooola jooola May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose a breaking change, but what about merging engine, engineOptions and lunrOptions, and add something like:

export type Engine =
  | {
    name: 'lunr'
    options?: {
      k1?: number
      b?: number
    }
  | {
    name: 'flexssearch'
    options?: FlexSearchOptions
  }

@jooola jooola mentioned this pull request May 7, 2021
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

Successfully merging this pull request may close these issues.

3 participants