@acodeninja/persist 3.1.0-next.2 → 3.1.0
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/package.json +1 -1
- package/src/Connection.js +7 -7
- package/src/data/SearchIndex.js +6 -6
package/package.json
CHANGED
package/src/Connection.js
CHANGED
@@ -483,10 +483,10 @@ export default class Connection {
|
|
483
483
|
* Retrieve a search index to query at your leisure.
|
484
484
|
*
|
485
485
|
* @param {Model.constructor} modelConstructor
|
486
|
-
* @return {SearchIndex}
|
486
|
+
* @return {Promise<SearchIndex>}
|
487
487
|
*/
|
488
|
-
|
489
|
-
return
|
488
|
+
getSearchIndex(modelConstructor) {
|
489
|
+
return this.#storage.getSearchIndex(modelConstructor)
|
490
490
|
.then(index => new SearchIndex(modelConstructor, index));
|
491
491
|
}
|
492
492
|
|
@@ -504,13 +504,13 @@ export default class Connection {
|
|
504
504
|
}
|
505
505
|
|
506
506
|
/**
|
507
|
-
* Retrieve
|
507
|
+
* Retrieve an index to query at your leisure.
|
508
508
|
*
|
509
509
|
* @param {Model.constructor} modelConstructor
|
510
|
-
* @return {FindIndex}
|
510
|
+
* @return {Promise<FindIndex>}
|
511
511
|
*/
|
512
|
-
|
513
|
-
return
|
512
|
+
getIndex(modelConstructor) {
|
513
|
+
return this.#storage.getIndex(modelConstructor)
|
514
514
|
.then(index => new FindIndex(modelConstructor, index));
|
515
515
|
}
|
516
516
|
|
package/src/data/SearchIndex.js
CHANGED
@@ -13,7 +13,7 @@ export class SearchResult {
|
|
13
13
|
}
|
14
14
|
|
15
15
|
/**
|
16
|
-
* A full-text search index wrapper using
|
16
|
+
* A full-text search index wrapper using Fuse.js for a given model.
|
17
17
|
* Supports indexing and querying model data.
|
18
18
|
*
|
19
19
|
* @class SearchIndex
|
@@ -39,7 +39,7 @@ export default class SearchIndex {
|
|
39
39
|
}
|
40
40
|
|
41
41
|
/**
|
42
|
-
* Performs a search query on the compiled
|
42
|
+
* Performs a search query on the compiled index.
|
43
43
|
*
|
44
44
|
* @param {string} query - The search string.
|
45
45
|
* @return {Array<SearchResult>} An array of search results with model instances and scores.
|
@@ -51,18 +51,18 @@ export default class SearchIndex {
|
|
51
51
|
}
|
52
52
|
|
53
53
|
/**
|
54
|
-
* Lazily compiles and returns the
|
54
|
+
* Lazily compiles and returns the index instance.
|
55
55
|
*
|
56
|
-
* @return {Fuse} The compiled
|
56
|
+
* @return {Fuse} The compiled index.
|
57
57
|
*/
|
58
58
|
get searchIndex() {
|
59
59
|
return this.#compiledIndex ?? this.#compileIndex();
|
60
60
|
}
|
61
61
|
|
62
62
|
/**
|
63
|
-
* Compiles the
|
63
|
+
* Compiles the index using the model's search properties.
|
64
64
|
*
|
65
|
-
* @return {Fuse} The compiled
|
65
|
+
* @return {Fuse} The compiled index.
|
66
66
|
* @private
|
67
67
|
*/
|
68
68
|
#compileIndex() {
|