Commit Graph

11 Commits

Author SHA1 Message Date
Naz
6ccec26a3a Fixed url attribute to returned search results
refs https://github.com/TryGhost/Team/issues/1665

- The url attribute was not indcluded in the doc index
2022-07-06 12:29:54 +02:00
Naz
b6ecad0488 Removed local storage caching
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)
2022-07-06 11:42:06 +02:00
Naz
21a9a4eaba 🐛 Fixed broken index when API returns no results
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.
2022-07-06 11:31:23 +02:00
Naz
8b59245893 Added urls to search resources
refs https://github.com/TryGhost/Team/issues/1665

- We need a way to visit the resource found through search. It should not be included in searchable fields though
2022-07-06 11:26:12 +02:00
Naz
592e051485 Connected tags to the search index
refs https://github.com/TryGhost/Team/issues/1665

- Tags should be searchable. This change hooks up the Tags Content API with the search index
2022-07-06 10:56:16 +02:00
Naz
dfc5b1c33d Connected authors to the search index
refs https://github.com/TryGhost/Team/issues/1665

- Authors should be searchable. This change hooks up the Authors Content API with the search index
2022-07-06 10:38:00 +02:00
Naz
df03c47ac1 Search results returning posts as separate attribute
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.
2022-07-05 17:35:29 +02:00
Rishabh
34a3e4ade7 Added redirect for post on search click
- allows click on post result to open it on click when searched
- adds `slug` to content api for data
2022-07-05 17:34:43 +02:00
Naz
b77fee0735 Added post properties to search results
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)
2022-07-05 16:38:37 +02:00
Naz
d9e9d451c9 Refactored search-index module to use class syntax
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)
2022-07-05 11:39:11 +02:00
Naz
f6838e2113 Added search index functionality
refs https://github.com/TryGhost/Team/issues/1665
refs 402e54987e/packages/ease/assets/js/main.js (L16-L127)

- This is a React adaptation of the referenced sodo-search functionality
- The module exposes two methods: init and search. Init requires an API URL parameter and an API key; search requires a text value and returns matching search results
2022-07-05 11:38:51 +02:00