diff --git a/README.md b/README.md
index c0f8c2b..61635ec 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,8 @@
FlexSearch v0.8: [Overview and Migration Guide](doc/0.8.0.md)
-
+
+[
](https://deepwiki.com/nextapps-de/flexsearch)
+
+
@@ -38,13 +41,13 @@ FlexSearch has been helping developers around the world build powerful, efficien
- 
+ 
Antithesis Operations LLC
-FlexSearch performs queries up to 1,000,000 times faster compared to other libraries by also providing powerful search capabilities like multi-field search (document search), phonetic transformations, partial matching, tag-search or suggestions.
+FlexSearch performs queries up to 1,000,000 times faster compared to other libraries by also providing powerful search capabilities 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/`
File Size (gzip) |
- 14.0 kb |
- 9.0 kb |
- 4.4 kb |
+ 16.3 kb |
+ 11.4 kb |
+ 4.5 kb |
diff --git a/index.d.ts b/index.d.ts
index 8addafe..ca204f2 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -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>;
}
- 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/
-
diff --git a/src/db/clickhouse/index.d.ts b/src/db/clickhouse/index.d.ts
new file mode 100644
index 0000000..4ea4f70
--- /dev/null
+++ b/src/db/clickhouse/index.d.ts
@@ -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;
+ open() : Promise;
+ close() : Promise;
+ destroy() : Promise;
+ clear() : Promise;
+ db: any;
+ }
+}
diff --git a/src/db/indexeddb/index.d.ts b/src/db/indexeddb/index.d.ts
new file mode 100644
index 0000000..0a9f5c0
--- /dev/null
+++ b/src/db/indexeddb/index.d.ts
@@ -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;
+ open() : Promise;
+ close() : Promise;
+ destroy() : Promise;
+ clear() : Promise;
+ db: IDBDatabase;
+ }
+}
diff --git a/src/db/mongodb/index.d.ts b/src/db/mongodb/index.d.ts
new file mode 100644
index 0000000..44b09d2
--- /dev/null
+++ b/src/db/mongodb/index.d.ts
@@ -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;
+ open() : Promise;
+ close() : Promise;
+ destroy() : Promise;
+ clear() : Promise;
+ db: any;
+ }
+}
diff --git a/src/db/postgres/index.d.ts b/src/db/postgres/index.d.ts
new file mode 100644
index 0000000..6ea0129
--- /dev/null
+++ b/src/db/postgres/index.d.ts
@@ -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;
+ open() : Promise;
+ close() : Promise;
+ destroy() : Promise;
+ clear() : Promise;
+ db: any;
+ }
+}
diff --git a/src/db/redis/index.d.ts b/src/db/redis/index.d.ts
new file mode 100644
index 0000000..a1c6df9
--- /dev/null
+++ b/src/db/redis/index.d.ts
@@ -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;
+ open() : Promise;
+ close() : Promise;
+ destroy() : Promise;
+ clear() : Promise;
+ db: any;
+ }
+}
diff --git a/src/db/sqlite/index.d.ts b/src/db/sqlite/index.d.ts
new file mode 100644
index 0000000..070d09b
--- /dev/null
+++ b/src/db/sqlite/index.d.ts
@@ -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;
+ open() : Promise;
+ close() : Promise;
+ destroy() : Promise;
+ clear() : Promise;
+ db: any;
+ }
+}
diff --git a/test/async.js b/test/async.js
index 20cbc4f..4fa23d6 100644
--- a/test/async.js
+++ b/test/async.js
@@ -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");