Skip to content

Overhaul serialize#543

Open
nickchomey wants to merge 9 commits into
nextapps-de:masterfrom
nickchomey:overhaul-serialize
Open

Overhaul serialize#543
nickchomey wants to merge 9 commits into
nextapps-de:masterfrom
nickchomey:overhaul-serialize

Conversation

@nickchomey

Copy link
Copy Markdown

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 Index and Document in 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:

  • The export/import documentation in doc/export-import.md has 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 both Index and Document. 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:

  • New methods are added and exported for both Index and Document classes: exportIndexBulk, importIndexBulk, exportDocumentBulk, importDocumentBulk, and serialize (now named serializeIndex/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:

  • The main bundle (src/bundle.js) now exports the new serialization and bulk import/export methods, as well as utility functions compress and decompress for string payloads. The FlexSearch object is updated to expose these helpers when serialization support is enabled. [1] [2] [3]

Internal and type improvements:

  • New typedefs are added to src/type.js to document the structure of serialized payloads for index context, index config, document fields, and document config, improving type safety and maintainability.
  • Internal properties are added to Index and Document to 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:

  • Major rewrite and expansion of doc/export-import.md to clarify export/import, fast-boot serialization, handling of custom functions, and new bulk APIs. [1] [2] [3] [4]

New serialization and bulk APIs:

  • Added exportIndexBulk, importIndexBulk, exportDocumentBulk, importDocumentBulk, and updated serialize methods for both Index and Document to support single-payload export/import and fast-boot serialization. [1] [2] [3] [4] [5] [6]

Public API and bundle updates:

  • Exposed new methods and utility functions (compress, decompress) in the public API and FlexSearch bundle, making them available for external use. [1] [2] [3]

Type and internal structure improvements:

  • Introduced new typedefs for serialized configs and updated internal properties to ensure correct config restoration and type safety. [1] [2] [3] [4] [5] [6]

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.

@nickchomey

Copy link
Copy Markdown
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant