mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-08-28 00:01:31 +02:00
minor improve readability of index.d.ts
This commit is contained in:
50
index.d.ts
vendored
50
index.d.ts
vendored
@@ -162,7 +162,13 @@ declare module "flexsearch" {
|
|||||||
LatinAdvanced: EncoderOptions,
|
LatinAdvanced: EncoderOptions,
|
||||||
LatinExtra: EncoderOptions,
|
LatinExtra: EncoderOptions,
|
||||||
LatinSoundex: EncoderOptions,
|
LatinSoundex: EncoderOptions,
|
||||||
CJK: EncoderOptions
|
CJK: EncoderOptions,
|
||||||
|
/** @deprecated */
|
||||||
|
LatinSimple: EncoderOptions,
|
||||||
|
/** @deprecated */
|
||||||
|
LatinExact: EncoderOptions,
|
||||||
|
/** @deprecated */
|
||||||
|
LatinDefault: EncoderOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -230,8 +236,15 @@ declare module "flexsearch" {
|
|||||||
* * Usage: https://github.com/nextapps-de/flexsearch#usage
|
* * Usage: https://github.com/nextapps-de/flexsearch#usage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type IndexSearchResultsWrapper<W extends boolean = false, D extends StorageInterface = undefined, R extends boolean = false> =
|
type IndexSearchResultsWrapper<
|
||||||
W extends false ? D extends undefined ? SearchResults<R> : Promise<SearchResults<R>> : Promise<SearchResults<R>>
|
W extends boolean = false,
|
||||||
|
D extends StorageInterface = undefined,
|
||||||
|
R extends boolean = false
|
||||||
|
> = W extends false
|
||||||
|
? D extends undefined
|
||||||
|
? SearchResults<R>
|
||||||
|
: Promise<SearchResults<R>>
|
||||||
|
: Promise<SearchResults<R>>
|
||||||
|
|
||||||
export class Index<W extends boolean = false, D extends StorageInterface = undefined> {
|
export class Index<W extends boolean = false, D extends StorageInterface = undefined> {
|
||||||
constructor(options?: Preset | IndexOptions<D>);
|
constructor(options?: Preset | IndexOptions<D>);
|
||||||
@@ -405,12 +418,13 @@ declare module "flexsearch" {
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
type DocumentSearchResults<D extends DocumentData = DocumentData, R extends boolean = false, E extends boolean = false, M extends boolean = false> =
|
type DocumentSearchResults<D extends DocumentData = DocumentData, R extends boolean = false, E extends boolean = false, M extends boolean = false> =
|
||||||
R extends true ? Resolver :
|
R extends true
|
||||||
M extends true ?
|
? Resolver
|
||||||
MergedDocumentSearchResults<D> :
|
: M extends true
|
||||||
E extends true ?
|
? MergedDocumentSearchResults<D>
|
||||||
EnrichedDocumentSearchResults<D> :
|
: E extends true
|
||||||
DefaultDocumentSearchResults
|
? EnrichedDocumentSearchResults<D>
|
||||||
|
: DefaultDocumentSearchResults
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -428,9 +442,12 @@ declare module "flexsearch" {
|
|||||||
* * Document search options: https://github.com/nextapps-de/flexsearch#document-search-options
|
* * Document search options: https://github.com/nextapps-de/flexsearch#document-search-options
|
||||||
*/
|
*/
|
||||||
|
|
||||||
type DocumentSearchOptions<D extends DocumentData = DocumentData, R extends boolean = false, E extends boolean = false, M extends boolean = false> =
|
type DocumentSearchOptions<
|
||||||
SearchOptions<R>
|
D extends DocumentData = DocumentData,
|
||||||
& {
|
R extends boolean = false,
|
||||||
|
E extends boolean = false,
|
||||||
|
M extends boolean = false
|
||||||
|
> = SearchOptions<R> & {
|
||||||
tag?: Object | Array<Object>;
|
tag?: Object | Array<Object>;
|
||||||
field?: Array<DocumentSearchOptions<D, R, E, M>> | DocumentSearchOptions<D, R, E, M> | string[] | string;
|
field?: Array<DocumentSearchOptions<D, R, E, M>> | DocumentSearchOptions<D, R, E, M> | string[] | string;
|
||||||
index?: Array<DocumentSearchOptions<D, R, E, M>> | DocumentSearchOptions<D, R, E, M> | string[] | string;
|
index?: Array<DocumentSearchOptions<D, R, E, M>> | DocumentSearchOptions<D, R, E, M> | string[] | string;
|
||||||
@@ -470,7 +487,11 @@ declare module "flexsearch" {
|
|||||||
* * API overview: https://github.com/nextapps-de/flexsearch#api-overview
|
* * API overview: https://github.com/nextapps-de/flexsearch#api-overview
|
||||||
* * Document store: https://github.com/nextapps-de/flexsearch#document-store
|
* * Document store: https://github.com/nextapps-de/flexsearch#document-store
|
||||||
*/
|
*/
|
||||||
export class Document<D extends DocumentData = DocumentData, W extends WorkerType = false, B extends StorageInterface = undefined> {
|
export class Document<
|
||||||
|
D extends DocumentData = DocumentData,
|
||||||
|
W extends WorkerType = false,
|
||||||
|
B extends StorageInterface = undefined
|
||||||
|
> {
|
||||||
constructor(options: DocumentOptions<D, W, B>);
|
constructor(options: DocumentOptions<D, W, B>);
|
||||||
|
|
||||||
add(id: Id, document: D): this | Promise<this>;
|
add(id: Id, document: D): this | Promise<this>;
|
||||||
@@ -648,7 +669,7 @@ declare module "flexsearch" {
|
|||||||
resolve?: boolean;
|
resolve?: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
offset?: number;
|
offset?: number;
|
||||||
/** only usable when "resolve" was set to true */
|
/** only usable when "resolve" was not set to false */
|
||||||
enrich?: boolean;
|
enrich?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -716,7 +737,6 @@ declare module "flexsearch" {
|
|||||||
db: any;
|
db: any;
|
||||||
|
|
||||||
constructor(name: string, config: PersistentOptions);
|
constructor(name: string, config: PersistentOptions);
|
||||||
|
|
||||||
constructor(config: string | PersistentOptions);
|
constructor(config: string | PersistentOptions);
|
||||||
|
|
||||||
mount(index: Index | Document): Promise<void>;
|
mount(index: Index | Document): Promise<void>;
|
||||||
|
Reference in New Issue
Block a user