@devisfuture/mega-collection 2.4.1 → 2.4.2

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 +1 -72
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -62,17 +62,6 @@ Each engine has its own entry point: `/search`, `/filter`, `/sort`.
62
62
  If you import only `@devisfuture/mega-collection/search`, only search code goes into the bundle.
63
63
  Unused modules are not included.
64
64
 
65
- ## Features
66
-
67
- | Capability | Strategy | Complexity |
68
- | ---------------------------- | ------------------------------------------ | ---------------------------------- |
69
- | **Indexed filter** | Hash-Map index (`Map<value, T[]>`) | **O(1)** |
70
- | **Multi-value filter** | Index intersection + `Set` membership | **O(k)** indexed / **O(n)** linear |
71
- | **Nested collection filter** | Pre-built nested index + `Set` lookup | **O(k)** indexed / **O(n)** linear |
72
- | **Text search** (contains) | N-gram (2–3 chars) inverted index + verify | **O(candidates)** |
73
- | **Nested collection search** | Nested n-gram index + verify | **O(candidates)** |
74
- | **Sorting** | Pre-sorted index (cached) / radix sort | **O(n)** cached / **O(n log n)** |
75
-
76
65
  ## How it works
77
66
 
78
67
  ### Search
@@ -118,13 +107,7 @@ The first sort call builds this index. Subsequent calls just read it in O(n). Th
118
107
 
119
108
  ## Benchmarks
120
109
 
121
- Benchmarks for `TextSearchEngine`, `FilterEngine`, and `SortEngine` are collected in [`BENCHMARKS`](./BENCHMARKS.md).
122
-
123
- Run the benchmark scripts locally to regenerate the numbers:
124
-
125
- - `npm run search-bench`
126
- - `npm run filter-bench`
127
- - `npm run sort-bench`
110
+ Benchmarks for `TextSearchEngine`, `FilterEngine`, and `SortEngine` are collected in [BENCHMARKS](./BENCHMARKS.md).
128
111
 
129
112
  ## React demo
130
113
 
@@ -341,12 +324,6 @@ Use `update(...)` when you need to replace one stored item by a unique field suc
341
324
  - `update(...)` replaces only the matched item in stored data.
342
325
  - configured indexes or caches refresh only the affected item instead of rebuilding the whole dataset.
343
326
 
344
- > **Notes on `update()`:**
345
- >
346
- > - The lookup field value in `data[field]` must already exist in the stored dataset. If it is `null`, `undefined`, or not found, `update()` is a silent no-op — no error is thrown and no data is changed.
347
- > - The lookup field value must not change between the old and new item. For example, calling `update({ field: 'id', data: { id: 99, ... } })` when no item has `id: 99` will do nothing. Always use the current value of the lookup field.
348
- > - When using `FilterEngine` with `filterByPreviousResult: true`, every `update()` resets the sequential criteria cache, so the next `filter()` will re-evaluate from the full dataset.
349
-
350
327
  ```ts
351
328
  import { MergeEngines } from "@devisfuture/mega-collection";
352
329
  import { TextSearchEngine } from "@devisfuture/mega-collection/search";
@@ -690,11 +667,6 @@ One class that combines search, filter, and sort for the same dataset.
690
667
  | `clearIndexes(module)` | Clear indexes for one module (`"search"`, `"sort"`, `"filter"`) |
691
668
  | `clearData(module)` | Clear the shared stored dataset through one imported module (`"search"`, `"sort"`, `"filter"`) |
692
669
 
693
- If `filter.mutableExcludeField` is configured, `filter([{ field, exclude }])` on that field removes items from the stored filter dataset with swap-pop.
694
- This changes the stored filter dataset and does not preserve order.
695
-
696
- `filter.filterByPreviousResult` is not supported inside `MergeEngines`. Use the root `filterByPreviousResult` option instead.
697
-
698
670
  ---
699
671
 
700
672
  ### `TextSearchEngine<T>` (search module)
@@ -769,49 +741,6 @@ Sort methods return plain arrays.
769
741
 
770
742
  ---
771
743
 
772
- **Note on `data` method:** Calling `data` updates the stored dataset. It also rebuilds configured indexes and resets internal state when needed, so usually you do not need to call `clearIndexes` before it.
773
-
774
- ## Types
775
-
776
- All types are exported from the root package and from each sub-module:
777
-
778
- ```ts
779
- import type {
780
- CollectionItem,
781
- IndexableKey,
782
- FilterCriterion,
783
- SortDescriptor,
784
- SortDirection,
785
- UpdateDescriptor,
786
- MergeEnginesOptions,
787
- } from "@devisfuture/mega-collection";
788
- ```
789
-
790
- You can also import them from individual sub-modules:
791
-
792
- ```ts
793
- import type {
794
- CollectionItem,
795
- IndexableKey,
796
- } from "@devisfuture/mega-collection/search";
797
- import type { FilterCriterion } from "@devisfuture/mega-collection/filter";
798
- import type {
799
- SortDescriptor,
800
- SortDirection,
801
- } from "@devisfuture/mega-collection/sort";
802
- ```
803
-
804
- ---
805
-
806
- ## Build
807
-
808
- ```bash
809
- npm install
810
- npm run build # Build ESM + declarations
811
- npm run typecheck # Type-check without emitting
812
- npm run dev # Watch mode
813
- ```
814
-
815
744
  ## Contributing
816
745
 
817
746
  See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devisfuture/mega-collection",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "description": "High-performance search, filter & sort engine for 100K+ item collections in JavaScript/TypeScript",
5
5
  "exports": {
6
6
  ".": {