refs https://github.com/TryGhost/Team/issues/1665
- This is a premature optimization that's causing loads of roadblocks while everyone is cracking on the feature (the data format changes, etc.)
- Once we are set on the format and need a performance boost we should design a suitable caching mechanism (the current one does not take resource updates into account, so can cause stale content)
refs https://github.com/TryGhost/Team/issues/1665
- The search index should be initialized regardless, even if there are no items to put into it the index should be an empty one.
refs https://github.com/TryGhost/Team/issues/1665
- The search results will be handling authors and tags searches as a next step - this change is a groundwork before making this move.
refs https://github.com/TryGhost/Team/issues/1665
- The npm package for elasticlunr does not contain the latest changes (no way to include document properties in search results). This hack adds document properties manually.
- Long term we should think about either helping the maintainer with releases of the library or weight out alternatives like fuse.js (https://fusejs.io)
refs https://github.com/TryGhost/Team/issues/1665
- The class syntax allows to use constructor DI pattern that helps with unit testing and abstracting away the dependencies
- It wasn't possible to test the internals without having access to the localStorage in tests (you couls access it but that's kind of leaky for tests to know what mechanism is used in the module intenally)