gs-search 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/node.cjs CHANGED
@@ -1 +1,99 @@
1
- "use strict";Object.create,Object.defineProperty,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.prototype.hasOwnProperty;exports.NodeStorage=class{#t=null;#i=null;#a;#s="";constructor(t){this.#a=t}async#e(){if(this.#t)return;const t=await import("fs/promises"),i=await import("path");this.#t=t,this.#i=i,this.#s=this.#i.join(process.cwd(),this.#a);try{await this.#t.access(this.#s)}catch{await this.#t.mkdir(this.#s,{recursive:!0})}}#r(t){return this.#i.join(this.#s,t)}async write(t,i){await this.#e(),await this.#t.writeFile(this.#r(t),Buffer.from(i))}async append(t,i){await this.#e(),await this.#t.appendFile(this.#r(t),Buffer.from(i))}async read(t){await this.#e();try{const i=await this.#t.readFile(this.#r(t));return i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}catch{return null}}async readRange(t,i,a){await this.#e();try{const s=await this.#t.open(this.#r(t),"r"),e=a-i,r=Buffer.alloc(e);return await s.read(r,0,e,i),await s.close(),r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}catch{return null}}async remove(t){await this.#e();try{await this.#t.unlink(this.#r(t))}catch{}}async listFiles(){await this.#e();try{return await this.#t.readdir(this.#s)}catch{return[]}}async clearAll(){await this.#e();try{const t=await this.#t.readdir(this.#s);for(const i of t)await this.#t.unlink(this.#i.join(this.#s,i))}catch{}}async getFileSize(t){await this.#e();try{return(await this.#t.stat(this.#r(t))).size}catch{return 0}}};
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __copyProps = (to, from, except, desc) => {
8
+ if (from && typeof from == "object" || typeof from == "function")
9
+ for (let key of __getOwnPropNames(from))
10
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ return to;
12
+ };
13
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
14
+ // If the importer is in node compatibility mode or this is not an ESM
15
+ // file that has been converted to a CommonJS file using a Babel-
16
+ // compatible transform (i.e. "__esModule" has not been set), then set
17
+ // "default" to the CommonJS "module.exports" for node compatibility.
18
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
19
+ mod
20
+ ));
21
+ class NodeStorage {
22
+ #fs = null;
23
+ #path = null;
24
+ #baseDir;
25
+ #fullDataDir = "";
26
+ constructor(baseDir) {
27
+ this.#baseDir = baseDir;
28
+ }
29
+ async #init() {
30
+ if (this.#fs) return;
31
+ const fsModule = await import("fs/promises"), pathModule = await import("path");
32
+ this.#fs = fsModule, this.#path = pathModule, this.#fullDataDir = this.#path.join(process.cwd(), this.#baseDir);
33
+ try {
34
+ await this.#fs.access(this.#fullDataDir);
35
+ } catch {
36
+ await this.#fs.mkdir(this.#fullDataDir, { recursive: !0 });
37
+ }
38
+ }
39
+ #p(filename) {
40
+ return this.#path.join(this.#fullDataDir, filename);
41
+ }
42
+ async write(filename, data) {
43
+ await this.#init(), await this.#fs.writeFile(this.#p(filename), Buffer.from(data));
44
+ }
45
+ async append(filename, data) {
46
+ await this.#init(), await this.#fs.appendFile(this.#p(filename), Buffer.from(data));
47
+ }
48
+ async read(filename) {
49
+ await this.#init();
50
+ try {
51
+ const buf = await this.#fs.readFile(this.#p(filename));
52
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
53
+ } catch {
54
+ return null;
55
+ }
56
+ }
57
+ async readRange(filename, start, end) {
58
+ await this.#init();
59
+ try {
60
+ const fd = await this.#fs.open(this.#p(filename), "r"), len = end - start, buf = Buffer.alloc(len);
61
+ return await fd.read(buf, 0, len, start), await fd.close(), buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
62
+ } catch {
63
+ return null;
64
+ }
65
+ }
66
+ async remove(filename) {
67
+ await this.#init();
68
+ try {
69
+ await this.#fs.unlink(this.#p(filename));
70
+ } catch {
71
+ }
72
+ }
73
+ async listFiles() {
74
+ await this.#init();
75
+ try {
76
+ return await this.#fs.readdir(this.#fullDataDir);
77
+ } catch {
78
+ return [];
79
+ }
80
+ }
81
+ async clearAll() {
82
+ await this.#init();
83
+ try {
84
+ const files = await this.#fs.readdir(this.#fullDataDir);
85
+ for (const f of files)
86
+ await this.#fs.unlink(this.#path.join(this.#fullDataDir, f));
87
+ } catch {
88
+ }
89
+ }
90
+ async getFileSize(filename) {
91
+ await this.#init();
92
+ try {
93
+ return (await this.#fs.stat(this.#p(filename))).size;
94
+ } catch {
95
+ return 0;
96
+ }
97
+ }
98
+ }
99
+ exports.NodeStorage = NodeStorage;
package/lib/node.js CHANGED
@@ -1 +1,81 @@
1
- class t{#t=null;#i=null;#a;#s="";constructor(t){this.#a=t}async#r(){if(this.#t)return;const t=await import("fs/promises"),i=await import("path");this.#t=t,this.#i=i,this.#s=this.#i.join(process.cwd(),this.#a);try{await this.#t.access(this.#s)}catch{await this.#t.mkdir(this.#s,{recursive:!0})}}#e(t){return this.#i.join(this.#s,t)}async write(t,i){await this.#r(),await this.#t.writeFile(this.#e(t),Buffer.from(i))}async append(t,i){await this.#r(),await this.#t.appendFile(this.#e(t),Buffer.from(i))}async read(t){await this.#r();try{const i=await this.#t.readFile(this.#e(t));return i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}catch{return null}}async readRange(t,i,a){await this.#r();try{const s=await this.#t.open(this.#e(t),"r"),r=a-i,e=Buffer.alloc(r);return await s.read(e,0,r,i),await s.close(),e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}catch{return null}}async remove(t){await this.#r();try{await this.#t.unlink(this.#e(t))}catch{}}async listFiles(){await this.#r();try{return await this.#t.readdir(this.#s)}catch{return[]}}async clearAll(){await this.#r();try{const t=await this.#t.readdir(this.#s);for(const i of t)await this.#t.unlink(this.#i.join(this.#s,i))}catch{}}async getFileSize(t){await this.#r();try{return(await this.#t.stat(this.#e(t))).size}catch{return 0}}}export{t as NodeStorage};
1
+ class NodeStorage {
2
+ #fs = null;
3
+ #path = null;
4
+ #baseDir;
5
+ #fullDataDir = "";
6
+ constructor(baseDir) {
7
+ this.#baseDir = baseDir;
8
+ }
9
+ async #init() {
10
+ if (this.#fs) return;
11
+ const fsModule = await import("fs/promises"), pathModule = await import("path");
12
+ this.#fs = fsModule, this.#path = pathModule, this.#fullDataDir = this.#path.join(process.cwd(), this.#baseDir);
13
+ try {
14
+ await this.#fs.access(this.#fullDataDir);
15
+ } catch {
16
+ await this.#fs.mkdir(this.#fullDataDir, { recursive: !0 });
17
+ }
18
+ }
19
+ #p(filename) {
20
+ return this.#path.join(this.#fullDataDir, filename);
21
+ }
22
+ async write(filename, data) {
23
+ await this.#init(), await this.#fs.writeFile(this.#p(filename), Buffer.from(data));
24
+ }
25
+ async append(filename, data) {
26
+ await this.#init(), await this.#fs.appendFile(this.#p(filename), Buffer.from(data));
27
+ }
28
+ async read(filename) {
29
+ await this.#init();
30
+ try {
31
+ const buf = await this.#fs.readFile(this.#p(filename));
32
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+ async readRange(filename, start, end) {
38
+ await this.#init();
39
+ try {
40
+ const fd = await this.#fs.open(this.#p(filename), "r"), len = end - start, buf = Buffer.alloc(len);
41
+ return await fd.read(buf, 0, len, start), await fd.close(), buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+ async remove(filename) {
47
+ await this.#init();
48
+ try {
49
+ await this.#fs.unlink(this.#p(filename));
50
+ } catch {
51
+ }
52
+ }
53
+ async listFiles() {
54
+ await this.#init();
55
+ try {
56
+ return await this.#fs.readdir(this.#fullDataDir);
57
+ } catch {
58
+ return [];
59
+ }
60
+ }
61
+ async clearAll() {
62
+ await this.#init();
63
+ try {
64
+ const files = await this.#fs.readdir(this.#fullDataDir);
65
+ for (const f of files)
66
+ await this.#fs.unlink(this.#path.join(this.#fullDataDir, f));
67
+ } catch {
68
+ }
69
+ }
70
+ async getFileSize(filename) {
71
+ await this.#init();
72
+ try {
73
+ return (await this.#fs.stat(this.#p(filename))).size;
74
+ } catch {
75
+ return 0;
76
+ }
77
+ }
78
+ }
79
+ export {
80
+ NodeStorage
81
+ };
package/lib/simple.cjs CHANGED
@@ -1 +1,64 @@
1
- "use strict";var t=require('./core');exports.SimpleSearch=class{static#t=null;static#e={baseDir:"simple_search_data",wordSegmentTokenThreshold:1e5,minWordTokenSave:0};static configure(e){const n={...this.#e,...e};this.#t=new t.SearchEngine(n)}static#n(){return this.#t||(this.#t=new t.SearchEngine(this.#e)),this.#t}static async startBatch(){this.#n().startBatch()}static async endBatch(){return this.#n().endBatch()}static async addDocument(t){return this.#n().addDocument(t)}static async addDocumentIfMissing(t){return this.#n().addDocumentIfMissing(t)}static async addDocuments(t){return this.#n().addDocuments(t)}static async addDocumentsIfMissing(t){return this.#n().addDocumentsIfMissing(t)}static async search(t,e){return this.#n().search(t,e)}static async removeDocument(t){return this.#n().removeDocument(t)}static async clearAll(){return this.#n().clearAll()}static async getStatus(){return this.#n().getStatus()}static async hasDocument(t){return this.#n().hasDocument(t)}};
1
+ "use strict";
2
+ var core = require('./core'), browser = require('./browser'), node = require('./node');
3
+ const DefaultOption = Object.freeze({
4
+ wordSegmentTokenThreshold: 1e5,
5
+ minWordTokenSave: 0
6
+ }), DefaultPath = "simple-search";
7
+ class SimpleSearch {
8
+ static #instance = null;
9
+ static #config;
10
+ static get config() {
11
+ if (this.#config)
12
+ return this.#config;
13
+ const config = { ...DefaultOption };
14
+ return typeof navigator < "u" && navigator?.storage?.getDirectory instanceof Function ? config.storage = new browser.BrowserStorage(DefaultPath) : config.storage = new node.NodeStorage(DefaultPath), this.#config = config;
15
+ }
16
+ /**
17
+ * 配置并初始化单例
18
+ */
19
+ static configure(config) {
20
+ this.#config = { ...this.config, ...config }, this.#instance && (this.#instance = new core.SearchEngine(this.config));
21
+ }
22
+ static async startBatch() {
23
+ this.#getInstance().startBatch();
24
+ }
25
+ static async endBatch() {
26
+ return this.#getInstance().endBatch();
27
+ }
28
+ static async addDocument(doc) {
29
+ return this.#getInstance().addDocument(doc);
30
+ }
31
+ static async addDocumentIfMissing(doc) {
32
+ return this.#getInstance().addDocumentIfMissing(doc);
33
+ }
34
+ static async addDocuments(docs) {
35
+ return this.#getInstance().addDocuments(docs);
36
+ }
37
+ static async addDocumentsIfMissing(docs) {
38
+ return this.#getInstance().addDocumentsIfMissing(docs);
39
+ }
40
+ static async search(query, limit) {
41
+ return this.#getInstance().search(query, limit);
42
+ }
43
+ static async removeDocument(id) {
44
+ return this.#getInstance().removeDocument(id);
45
+ }
46
+ static async clearAll() {
47
+ return this.#getInstance().clearAll();
48
+ }
49
+ static async getStatus() {
50
+ return this.#getInstance().getStatus();
51
+ }
52
+ /**
53
+ * 检查文档ID是否曾经添加过(包括已删除的)
54
+ * @param id 文档ID
55
+ * @returns 文档是否曾经添加过的布尔值
56
+ */
57
+ static async hasDocument(id) {
58
+ return this.#getInstance().hasDocument(id);
59
+ }
60
+ static #getInstance() {
61
+ return this.#instance || (this.#instance = new core.SearchEngine(this.config)), this.#instance;
62
+ }
63
+ }
64
+ exports.SimpleSearch = SimpleSearch;
package/lib/simple.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as ___type from './type';
2
- import { ISearchEngineConfig, IDocument, IDocumentBase } from './type';
2
+ import { ISearchEngineOption, IDocument, IDocumentBase } from './type';
3
3
 
4
4
  /**
5
5
  * 快速使用封装
@@ -7,27 +7,21 @@ import { ISearchEngineConfig, IDocument, IDocumentBase } from './type';
7
7
  */
8
8
  declare class SimpleSearch {
9
9
  #private;
10
+ static get config(): ISearchEngineOption;
10
11
  /**
11
12
  * 配置并初始化单例
12
13
  */
13
- static configure(config: Partial<ISearchEngineConfig>): void;
14
+ static configure(config: Partial<ISearchEngineOption>): void;
14
15
  static startBatch(): Promise<void>;
15
16
  static endBatch(): Promise<void>;
16
17
  static addDocument<T extends IDocument = IDocument>(doc: T): Promise<void>;
17
18
  static addDocumentIfMissing<T extends IDocument = IDocument>(doc: T): Promise<void>;
18
19
  static addDocuments<T extends IDocument = IDocument>(docs: T[]): Promise<void>;
19
20
  static addDocumentsIfMissing<T extends IDocument = IDocument>(docs: T[]): Promise<void>;
20
- static search<T extends IDocumentBase = IDocumentBase>(query: T | string, limit?: number): Promise<___type.IResult[]>;
21
+ static search<T extends IDocumentBase = any>(query: T | string, limit?: number): Promise<___type.IResult[]>;
21
22
  static removeDocument(id: number): Promise<void>;
22
23
  static clearAll(): Promise<void>;
23
- static getStatus(): Promise<{
24
- wordSegments: number;
25
- charSegments: number;
26
- deleted: number;
27
- wordCacheSize: number;
28
- charCacheSize: number;
29
- inBatch: boolean;
30
- }>;
24
+ static getStatus(): Promise<___type.ISearchEngineStatus>;
31
25
  /**
32
26
  * 检查文档ID是否曾经添加过(包括已删除的)
33
27
  * @param id 文档ID
package/lib/simple.js CHANGED
@@ -1 +1,67 @@
1
- import{SearchEngine as t}from'./core';class s{static#t=null;static#s={baseDir:"simple_search_data",wordSegmentTokenThreshold:1e5,minWordTokenSave:0};static configure(s){const n={...this.#s,...s};this.#t=new t(n)}static#n(){return this.#t||(this.#t=new t(this.#s)),this.#t}static async startBatch(){this.#n().startBatch()}static async endBatch(){return this.#n().endBatch()}static async addDocument(t){return this.#n().addDocument(t)}static async addDocumentIfMissing(t){return this.#n().addDocumentIfMissing(t)}static async addDocuments(t){return this.#n().addDocuments(t)}static async addDocumentsIfMissing(t){return this.#n().addDocumentsIfMissing(t)}static async search(t,s){return this.#n().search(t,s)}static async removeDocument(t){return this.#n().removeDocument(t)}static async clearAll(){return this.#n().clearAll()}static async getStatus(){return this.#n().getStatus()}static async hasDocument(t){return this.#n().hasDocument(t)}}export{s as SimpleSearch};
1
+ import { SearchEngine } from './core';
2
+ import { BrowserStorage } from './browser';
3
+ import { NodeStorage } from './node';
4
+ const DefaultOption = Object.freeze({
5
+ wordSegmentTokenThreshold: 1e5,
6
+ minWordTokenSave: 0
7
+ }), DefaultPath = "simple-search";
8
+ class SimpleSearch {
9
+ static #instance = null;
10
+ static #config;
11
+ static get config() {
12
+ if (this.#config)
13
+ return this.#config;
14
+ const config = { ...DefaultOption };
15
+ return typeof navigator < "u" && navigator?.storage?.getDirectory instanceof Function ? config.storage = new BrowserStorage(DefaultPath) : config.storage = new NodeStorage(DefaultPath), this.#config = config;
16
+ }
17
+ /**
18
+ * 配置并初始化单例
19
+ */
20
+ static configure(config) {
21
+ this.#config = { ...this.config, ...config }, this.#instance && (this.#instance = new SearchEngine(this.config));
22
+ }
23
+ static async startBatch() {
24
+ this.#getInstance().startBatch();
25
+ }
26
+ static async endBatch() {
27
+ return this.#getInstance().endBatch();
28
+ }
29
+ static async addDocument(doc) {
30
+ return this.#getInstance().addDocument(doc);
31
+ }
32
+ static async addDocumentIfMissing(doc) {
33
+ return this.#getInstance().addDocumentIfMissing(doc);
34
+ }
35
+ static async addDocuments(docs) {
36
+ return this.#getInstance().addDocuments(docs);
37
+ }
38
+ static async addDocumentsIfMissing(docs) {
39
+ return this.#getInstance().addDocumentsIfMissing(docs);
40
+ }
41
+ static async search(query, limit) {
42
+ return this.#getInstance().search(query, limit);
43
+ }
44
+ static async removeDocument(id) {
45
+ return this.#getInstance().removeDocument(id);
46
+ }
47
+ static async clearAll() {
48
+ return this.#getInstance().clearAll();
49
+ }
50
+ static async getStatus() {
51
+ return this.#getInstance().getStatus();
52
+ }
53
+ /**
54
+ * 检查文档ID是否曾经添加过(包括已删除的)
55
+ * @param id 文档ID
56
+ * @returns 文档是否曾经添加过的布尔值
57
+ */
58
+ static async hasDocument(id) {
59
+ return this.#getInstance().hasDocument(id);
60
+ }
61
+ static #getInstance() {
62
+ return this.#instance || (this.#instance = new SearchEngine(this.config)), this.#instance;
63
+ }
64
+ }
65
+ export {
66
+ SimpleSearch
67
+ };
package/lib/type.cjs CHANGED
@@ -1 +1,3 @@
1
1
  "use strict";
2
+ const _ = "";
3
+ exports._ = "";
package/lib/type.d.ts CHANGED
@@ -66,12 +66,9 @@ interface IStorage {
66
66
  */
67
67
  type IndexType = 'word' | 'char';
68
68
 
69
- interface ISearchEngineConfig {
70
- /**
71
- * 数据存储的基础目录 (必填)
72
- * 用于区分不同的搜索引擎实例
73
- */
74
- baseDir: string;
69
+ type IndexingTokenizer = <T extends IDocument = IDocument>(doc: T) => string[];
70
+ type SearchTokenizer = <T extends IDocumentBase = IDocumentBase>(doc: T) => string[];
71
+ interface ISearchEngineOption {
75
72
  /**
76
73
  * 存储实现配置 (可选)
77
74
  * - 'browser': 强制使用 OPFS (BrowserStorage)
@@ -79,7 +76,7 @@ interface ISearchEngineConfig {
79
76
  * - IStorage: 传入自定义的存储实例
80
77
  * - undefined: 自动检测环境
81
78
  */
82
- storage?: 'browser' | 'node' | IStorage;
79
+ storage: IStorage;
83
80
  /**
84
81
  * 索引时使用的分词器 (算法核心配置)
85
82
  * - 作用: 将文档文本转换为索引用的token序列
@@ -87,7 +84,7 @@ interface ISearchEngineConfig {
87
84
  * - 建议: 针对不同语言(中文/英文/日文等)使用专门的分词实现
88
85
  * - 影响: 直接决定索引的粒度和搜索的准确性
89
86
  */
90
- indexingTokenizer?: <T extends IDocument = IDocument>(doc: T) => string[];
87
+ indexingTokenizer?: IndexingTokenizer;
91
88
  /**
92
89
  * 搜索时使用的分词器 (算法核心配置)
93
90
  * - 作用: 将查询文本转换为搜索用的token序列
@@ -95,7 +92,7 @@ interface ISearchEngineConfig {
95
92
  * - 建议: 与indexingTokenizer保持一致的分词策略以确保搜索准确性
96
93
  * - 影响: 直接决定搜索匹配的范围和结果的相关性
97
94
  */
98
- searchTokenizer?: <T extends IDocumentBase = IDocumentBase>(doc: T) => string[];
95
+ searchTokenizer?: SearchTokenizer;
99
96
  /**
100
97
  * 词索引分段阈值 (Token数) - 分段算法配置
101
98
  * - 作用: 控制词索引文件的大小,超过阈值时创建新的索引段
@@ -130,6 +127,52 @@ interface ISearchEngineConfig {
130
127
  minCharTokenSave?: number;
131
128
  }
132
129
 
130
+ interface ISearchEngineStatus {
131
+ wordSegments: number;
132
+ charSegments: number;
133
+ deleted: number;
134
+ wordCacheSize: number;
135
+ charCacheSize: number;
136
+ inBatch: boolean;
137
+ }
138
+ /**
139
+ * 核心搜索引擎
140
+ */
141
+ interface ISearchEngine {
142
+ /**
143
+ * 开启批处理
144
+ * 批处理期间 addDocuments 只写入缓存,不触发索引段构建
145
+ */
146
+ startBatch(): void;
147
+ /**
148
+ * 结束批处理
149
+ * 触发索引构建检查并保存元数据
150
+ */
151
+ endBatch(): Promise<void>;
152
+ addDocument<T extends IDocument = IDocument>(doc: T): Promise<void>;
153
+ /**
154
+ * 添加单个文档,如果文档ID已存在则跳过
155
+ * 用于在批量添加中途出错后的恢复添加行为,也可直接用于单个文档添加
156
+ */
157
+ addDocumentIfMissing<T extends IDocument = IDocument>(doc: T): Promise<void>;
158
+ /**
159
+ * 添加多个文档,跳过已存在的文档ID
160
+ * 用于在批量添加中途出错后的恢复添加行为,也可直接用于批量添加
161
+ */
162
+ addDocumentsIfMissing<T extends IDocument = IDocument>(docs: T[]): Promise<void>;
163
+ addDocuments<T extends IDocument = IDocument>(docs: T[]): Promise<void>;
164
+ search<T extends IDocumentBase | string = any>(query: string, limit?: number): Promise<IResult[]>;
165
+ removeDocument(id: number): Promise<void>;
166
+ clearAll(): Promise<void>;
167
+ getStatus(): Promise<ISearchEngineStatus>;
168
+ /**
169
+ * 检查文档ID是否曾经添加过(包括已删除的)
170
+ * @param id 文档ID
171
+ * @returns 文档是否曾经添加过的布尔值
172
+ */
173
+ hasDocument(id: number): Promise<boolean>;
174
+ }
175
+
133
176
 
134
177
 
135
- export type { IDocument, IDocumentBase, IIndexMeta, IResult, ISearchEngineConfig, ISegmentMeta, IStorage, ITokenizedDoc, IndexType };
178
+ export type { IDocument, IDocumentBase, IIndexMeta, IResult, ISearchEngine, ISearchEngineOption, ISearchEngineStatus, ISegmentMeta, IStorage, ITokenizedDoc, IndexType, IndexingTokenizer, SearchTokenizer };
package/lib/type.js CHANGED
@@ -0,0 +1 @@
1
+ const _ = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gs-search",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",