Overhaul serialize#543
Open
nickchomey wants to merge 9 commits into
Open
Conversation
…efore import/inject
kitchen sink tests + score function serialization
…ialize, add tests
…copy fix Closure Compiler advanced mode tests replace bracket notation with @export and fix bundle debug warnings
Author
|
@ts-thomas its been 3 months since I worked on/looked at this. I dont really remember everything I did or why. But it was a significant overhaul to bring the functionality proposed in #538. I think one goal was to fill-in all the missing stuff from serialization such that the entire flexsearch object, indexes etc could be fully exported and imported. I think it was only partially implemented previously, and I believe it has full coverage now. At a glance, copilot's summary above makes sense. I'm happy to iterate if you can provide feedback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: Copilot-generated summary
This pull request significantly improves and extends the documentation and code support for serialization, export/import, and bulk operations for both
IndexandDocumentin FlexSearch. The changes clarify how configuration is handled during export/import, introduce new bulk APIs, and expose additional serialization utilities in the public API. These updates make it easier and safer for users to persist, transfer, and restore search indexes and document indexes, especially when custom configurations are involved.Documentation improvements and new usage patterns:
doc/export-import.mdhas been thoroughly updated to clarify that index configuration is now included in the export payload, removing the need to manually specify config on import. It details how inline custom functions are handled, introduces new fast-boot serialization options (including self-contained inject), and explains the new bulk export/import APIs for bothIndexandDocument. The docs now also describe utility helpers for compression and decompression, and provide a comprehensive API reference table. [1] [2] [3] [4]New and extended APIs for serialization and bulk operations:
IndexandDocumentclasses:exportIndexBulk,importIndexBulk,exportDocumentBulk,importDocumentBulk, andserialize(now namedserializeIndex/serializeDocument). These methods enable exporting and importing all data in a single payload (optionally compressed), and allow for fast-boot serialization with embedded config. [1] [2] [3] [4] [5] [6]Public API and bundle exports:
src/bundle.js) now exports the new serialization and bulk import/export methods, as well as utility functionscompressanddecompressfor string payloads. TheFlexSearchobject is updated to expose these helpers when serialization support is enabled. [1] [2] [3]Internal and type improvements:
src/type.jsto document the structure of serialized payloads for index context, index config, document fields, and document config, improving type safety and maintainability.IndexandDocumentto keep track of original config and field keys, ensuring correct restoration after import or serialization. [1] [2] [3] [4] [5]Summary of most important changes:
Documentation and developer guidance:
doc/export-import.mdto clarify export/import, fast-boot serialization, handling of custom functions, and new bulk APIs. [1] [2] [3] [4]New serialization and bulk APIs:
exportIndexBulk,importIndexBulk,exportDocumentBulk,importDocumentBulk, and updatedserializemethods for bothIndexandDocumentto support single-payload export/import and fast-boot serialization. [1] [2] [3] [4] [5] [6]Public API and bundle updates:
compress,decompress) in the public API andFlexSearchbundle, making them available for external use. [1] [2] [3]Type and internal structure improvements:
Overall, these changes make FlexSearch's export/import and serialization features more robust, easier to use, and better documented for both standard and advanced use cases.