1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-08-27 07:44:35 +02:00

Merge branch 'master' into master

This commit is contained in:
flycran
2025-05-06 17:34:01 +08:00
committed by GitHub
9 changed files with 306 additions and 38 deletions

View File

@@ -1,5 +1,8 @@
FlexSearch v0.8: [Overview and Migration Guide](doc/0.8.0.md)
<h1></h1>
[<img src="https://devin.ai/assets/deepwiki-badge.png" alt="Ask DeepWiki.com" height="20"/>](https://deepwiki.com/nextapps-de/flexsearch)
<h2></h2>
<h1>
<img src="doc/flexsearch-logo-glass-animated.svg" style="width: 580px; max-width: 100%" alt="FlexSearch.js: Next-Generation full-text search library for Browser and Node.js">
<p></p>
@@ -38,13 +41,13 @@ FlexSearch has been helping developers around the world build powerful, efficien
<a href="https://antithesis.com" target="_blank" style="display: inline-block">
<center>
<img src="doc/antithesis_logo.svg" width="180" alt="Donate using Open Collective"><br>
<img src="doc/antithesis_logo.svg" width="200" alt="Donate using Open Collective"><br>
Antithesis Operations LLC
</center>
</a>
<h1></h1>
FlexSearch performs queries up to 1,000,000 times faster <a href="https://nextapps-de.github.io/flexsearch/" target="_blank">compared to other libraries</a> by also providing <a href="https://nextapps-de.github.io/flexsearch/match.html" target="_blank">powerful search capabilities</a> like multi-field search (document search), phonetic transformations, partial matching, tag-search or suggestions.
FlexSearch performs queries up to 1,000,000 times faster <a href="https://nextapps-de.github.io/flexsearch/" target="_blank">compared to other libraries</a> by also providing <a href="https://nextapps-de.github.io/flexsearch/match.html" target="_blank">powerful search capabilities</a> like multi-field search (document search), phonetic transformations, partial matching, tag-search, result highlighting or suggestions.
Bigger workloads are scalable through workers to perform any updates or queries to the index in parallel through dedicated balanced threads.
@@ -561,9 +564,9 @@ The **_dist_** folder is located in: `node_modules/flexsearch/dist/`
</tr>
<tr>
<td>File Size (gzip)</td>
<td>14.0 kb</td>
<td>9.0 kb</td>
<td>4.4 kb</td>
<td>16.3 kb</td>
<td>11.4 kb</td>
<td>4.5 kb</td>
</tr>
</table>

81
index.d.ts vendored
View File

@@ -160,7 +160,8 @@ declare module "flexsearch" {
LatinBalance: EncoderOptions,
LatinAdvanced: EncoderOptions,
LatinExtra: EncoderOptions,
LatinSoundex: EncoderOptions
LatinSoundex: EncoderOptions,
CJK: EncoderOptions
};
/**
@@ -199,7 +200,7 @@ declare module "flexsearch" {
commit?: boolean;
// Language-specific Options and Encoding
encoder?: typeof Charset | Encoders | EncoderOptions;
encoder?: typeof Charset | Encoders | EncoderOptions | Encoder;
encode?: (text: string) => string[],
rtl?: boolean;
};
@@ -598,34 +599,6 @@ declare module "flexsearch" {
): Promise<DocumentSearchResults<D, R, E, M>>;
}
type IdType =
"text" |
"char" |
"varchar" |
"string" |
"number" |
"numeric" |
"integer" |
"smallint" |
"tinyint" |
"mediumint" |
"int" |
"int8" |
"uint8" |
"int16" |
"uint16" |
"int32" |
"uint32" |
"int64" |
"uint64" |
"bigint";
type PersistentOptions = {
name?: string;
type?: IdType;
db?: any;
};
type DefaultResolve = {
query?: string;
limit?: number;
@@ -744,7 +717,53 @@ declare module "flexsearch" {
export default FlexSearch;
}
// -----------------------------------
type IdType =
"text" |
"char" |
"varchar" |
"string" |
"number" |
"numeric" |
"integer" |
"smallint" |
"tinyint" |
"mediumint" |
"int" |
"int8" |
"uint8" |
"int16" |
"uint16" |
"int32" |
"uint32" |
"int64" |
"uint64" |
"bigint";
type PersistentOptions = {
name?: string;
type?: IdType;
db?: any;
};
declare module "flexsearch/db/*" {
export default StorageInterface;
}
declare module "flexsearch/db/indexeddb" {
export default class IndexedDB extends StorageInterface{
db: IDBDatabase
}
}
// -----------------------------------
declare module "flexsearch/lang/*" {
const Options: EncoderOptions;
export default Options;
}
// https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
// https://github.com/futurGH/ts-to-jsdoc
// https://sethmac.com/typescript-to-jsdoc/

41
src/db/clickhouse/index.d.ts vendored Normal file
View File

@@ -0,0 +1,41 @@
declare module "flexsearch/db/clickhouse" {
type IdType =
"text" |
"char" |
"varchar" |
"string" |
"number" |
"numeric" |
"integer" |
"smallint" |
"tinyint" |
"mediumint" |
"int" |
"int8" |
"uint8" |
"int16" |
"uint16" |
"int32" |
"uint32" |
"int64" |
"uint64" |
"bigint";
type PersistentOptions = {
name?: string;
type?: IdType;
db?: any;
};
export default class StorageInterface {
constructor(name: string, config: PersistentOptions);
constructor(config: string | PersistentOptions);
//mount(index: Index | Document) : Promise<void>;
open() : Promise<void>;
close() : Promise<void>;
destroy() : Promise<void>;
clear() : Promise<void>;
db: any;
}
}

41
src/db/indexeddb/index.d.ts vendored Normal file
View File

@@ -0,0 +1,41 @@
declare module "flexsearch/db/indexeddb" {
type IdType =
"text" |
"char" |
"varchar" |
"string" |
"number" |
"numeric" |
"integer" |
"smallint" |
"tinyint" |
"mediumint" |
"int" |
"int8" |
"uint8" |
"int16" |
"uint16" |
"int32" |
"uint32" |
"int64" |
"uint64" |
"bigint";
type PersistentOptions = {
name?: string;
type?: IdType;
db?: IDBDatabase;
};
export default class StorageInterface {
constructor(name: string, config: PersistentOptions);
constructor(config: string | PersistentOptions);
//mount(index: Index | Document) : Promise<void>;
open() : Promise<void>;
close() : Promise<void>;
destroy() : Promise<void>;
clear() : Promise<void>;
db: IDBDatabase;
}
}

41
src/db/mongodb/index.d.ts vendored Normal file
View File

@@ -0,0 +1,41 @@
declare module "flexsearch/db/mongodb" {
type IdType =
"text" |
"char" |
"varchar" |
"string" |
"number" |
"numeric" |
"integer" |
"smallint" |
"tinyint" |
"mediumint" |
"int" |
"int8" |
"uint8" |
"int16" |
"uint16" |
"int32" |
"uint32" |
"int64" |
"uint64" |
"bigint";
type PersistentOptions = {
name?: string;
type?: IdType;
db?: any;
};
export default class StorageInterface {
constructor(name: string, config: PersistentOptions);
constructor(config: string | PersistentOptions);
//mount(index: Index | Document) : Promise<void>;
open() : Promise<void>;
close() : Promise<void>;
destroy() : Promise<void>;
clear() : Promise<void>;
db: any;
}
}

41
src/db/postgres/index.d.ts vendored Normal file
View File

@@ -0,0 +1,41 @@
declare module "flexsearch/db/postgres" {
type IdType =
"text" |
"char" |
"varchar" |
"string" |
"number" |
"numeric" |
"integer" |
"smallint" |
"tinyint" |
"mediumint" |
"int" |
"int8" |
"uint8" |
"int16" |
"uint16" |
"int32" |
"uint32" |
"int64" |
"uint64" |
"bigint";
type PersistentOptions = {
name?: string;
type?: IdType;
db?: any;
};
export default class StorageInterface {
constructor(name: string, config: PersistentOptions);
constructor(config: string | PersistentOptions);
//mount(index: Index | Document) : Promise<void>;
open() : Promise<void>;
close() : Promise<void>;
destroy() : Promise<void>;
clear() : Promise<void>;
db: any;
}
}

41
src/db/redis/index.d.ts vendored Normal file
View File

@@ -0,0 +1,41 @@
declare module "flexsearch/db/redis" {
type IdType =
"text" |
"char" |
"varchar" |
"string" |
"number" |
"numeric" |
"integer" |
"smallint" |
"tinyint" |
"mediumint" |
"int" |
"int8" |
"uint8" |
"int16" |
"uint16" |
"int32" |
"uint32" |
"int64" |
"uint64" |
"bigint";
type PersistentOptions = {
name?: string;
type?: IdType;
db?: any;
};
export default class StorageInterface {
constructor(name: string, config: PersistentOptions);
constructor(config: string | PersistentOptions);
//mount(index: Index | Document) : Promise<void>;
open() : Promise<void>;
close() : Promise<void>;
destroy() : Promise<void>;
clear() : Promise<void>;
db: any;
}
}

41
src/db/sqlite/index.d.ts vendored Normal file
View File

@@ -0,0 +1,41 @@
declare module "flexsearch/db/sqlite" {
type IdType =
"text" |
"char" |
"varchar" |
"string" |
"number" |
"numeric" |
"integer" |
"smallint" |
"tinyint" |
"mediumint" |
"int" |
"int8" |
"uint8" |
"int16" |
"uint16" |
"int32" |
"uint32" |
"int64" |
"uint64" |
"bigint";
type PersistentOptions = {
name?: string;
type?: IdType;
db?: any;
};
export default class StorageInterface {
constructor(name: string, config: PersistentOptions);
constructor(config: string | PersistentOptions);
//mount(index: Index | Document) : Promise<void>;
open() : Promise<void>;
close() : Promise<void>;
destroy() : Promise<void>;
clear() : Promise<void>;
db: any;
}
}

View File

@@ -57,7 +57,7 @@ if(!build_light) describe("Add (Async)", function(){
if(duration) break;
}
expect(duration).to.closeTo(0, 3);
expect(duration).to.closeTo(0, 4);
for(let i = 0; i < 999999999; i++){
await index.addAsync(i, "foo");