nextapps-de / flexsearch

Next-Generation full text search library for Browser and Node.js
Apache License 2.0
12.53k stars 491 forks source link

`IndexOptions` TS interface is missing some options #423

Open thexeos opened 10 months ago

thexeos commented 10 months ago

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 commented 10 months ago

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

image

image

waynedunkley commented 3 months ago

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;
  }
}