flexsearch icon indicating copy to clipboard operation
flexsearch copied to clipboard

`IndexOptions` TS interface is missing some options

Open thexeos opened this issue 1 year ago • 2 comments

The new type definitions are incredible. However it is missing some described, but not explicitly documented Index Options.

image

From Memory Allocation section: minlength: number, fastupdate: boolean

From Right-To-Left Support section: rtl: boolean

thexeos avatar Jan 13 '24 03:01 thexeos

I've also noticed that DocumentOptions interface has id as required field, however it can be left empty to default to "id".

image

image

thexeos avatar Jan 13 '24 03:01 thexeos

Until this is resolved you can patch the IndexOptions type definition and include the missing properties that you want to use.

In my case I wanted to use the minlength property.

import FlexSearch from 'flexsearch'

declare module 'flexsearch' {
  interface IndexOptions<T, Store extends StoreOption = false> {
    minlength?: number;
  }
}

waynedunkley avatar Aug 13 '24 10:08 waynedunkley