@devisfuture/mega-collection 2.0.3 → 2.1.4

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.
Files changed (2) hide show
  1. package/README.md +14 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -100,10 +100,11 @@ Each instance keeps its own data and its own indexes, so they work separately
100
100
  and do not overwrite each other.
101
101
 
102
102
  Each engine accepts an optional `fields` array (set via the `search`,
103
- `filter` or `sort` option) which tells it which properties should be indexed up
104
- front. This means the engine prepares those fields once so later calls can be
105
- faster. If you skip `fields`, everything still works, but the engine may need
106
- to scan the full array.
103
+ `filter` or `sort` option) which tells it which properties should use indexed
104
+ execution. Those indexes are built lazily on the first matching operation, so
105
+ initial engine creation stays fast even for very large collections. If you skip
106
+ `fields`, everything still works, but the engine may need to scan the full
107
+ array.
107
108
 
108
109
  ```ts
109
110
  import { MergeEngines } from "@devisfuture/mega-collection";
@@ -175,8 +176,9 @@ The examples below show the difference between simple fields and nested fields.
175
176
  ```ts
176
177
  import { TextSearchEngine } from "@devisfuture/mega-collection/search";
177
178
 
178
- // `fields` tells the engine which fields it should prepare for faster search.
179
- // If you skip `fields`, search still works, but it will scan the full dataset.
179
+ // `fields` tells the engine which fields should use indexed search.
180
+ // The index is built lazily on first use. If you skip `fields`, search still
181
+ // works, but it will scan the full dataset.
180
182
  const engine = new TextSearchEngine<User>({
181
183
  data: users,
182
184
  fields: ["name", "city"],
@@ -227,8 +229,9 @@ The examples below show the difference between simple fields and nested fields.
227
229
  ```ts
228
230
  import { FilterEngine } from "@devisfuture/mega-collection/filter";
229
231
 
230
- // `fields` tells the engine which fields should be prepared for faster filter
231
- // lookups. Without `fields`, filtering still works, but it will scan the data.
232
+ // `fields` tells the engine which fields should use indexed filter lookups.
233
+ // The index is built lazily on first use. Without `fields`, filtering still
234
+ // works, but it will scan the data.
232
235
  const engine = new FilterEngine<User>({
233
236
  data: users,
234
237
  fields: ["city", "age"],
@@ -287,8 +290,9 @@ Use `SortEngine` when you only need sorting.
287
290
  ```ts
288
291
  import { SortEngine } from "@devisfuture/mega-collection/sort";
289
292
 
290
- // `fields` tells the engine which fields should be prepared for faster
291
- // single-field sorting. If you skip `fields`, sorting still works.
293
+ // `fields` tells the engine which fields should use cached single-field
294
+ // sorting. The cache is built lazily on first use. If you skip `fields`,
295
+ // sorting still works.
292
296
  const engine = new SortEngine<User>({
293
297
  data: users,
294
298
  fields: ["age", "name", "city"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devisfuture/mega-collection",
3
- "version": "2.0.3",
3
+ "version": "2.1.4",
4
4
  "description": "High-performance search, filter & sort engine for 100K+ item collections in JavaScript/TypeScript",
5
5
  "exports": {
6
6
  ".": {